MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / CheckPosixThreading

Function CheckPosixThreading

steps/cpplint.py:2624–2647  ·  view source on GitHub ↗

Checks for calls to thread-unsafe functions. Much code has been originally written without consideration of multi-threading. Also, engineers are relying on their old experience; they have learned posix before threading extensions were added. These tests guide the engineers to use thread-saf

(filename, clean_lines, linenum, error)

Source from the content-addressed store, hash-verified

2622
2623
2624def CheckPosixThreading(filename, clean_lines, linenum, error):
2625 """Checks for calls to thread-unsafe functions.
2626
2627 Much code has been originally written without consideration of
2628 multi-threading. Also, engineers are relying on their old experience;
2629 they have learned posix before threading extensions were added. These
2630 tests guide the engineers to use thread-safe functions (when using
2631 posix directly).
2632
2633 Args:
2634 filename: The name of the current file.
2635 clean_lines: A CleansedLines instance containing the file.
2636 linenum: The number of the line to check.
2637 error: The function to call with any errors found.
2638 """
2639 line = clean_lines.elided[linenum]
2640 for single_thread_func, multithread_safe_func, pattern in _THREADING_LIST:
2641 # Additional pattern matching check to confirm that this is the
2642 # function we are looking for
2643 if Search(pattern, line):
2644 error(filename, linenum, 'runtime/threadsafe_fn', 2,
2645 'Consider using ' + multithread_safe_func +
2646 '...) instead of ' + single_thread_func +
2647 '...) for improved thread safety.')
2648
2649
2650def CheckVlogArguments(filename, clean_lines, linenum, error):

Callers 1

ProcessLineFunction · 0.85

Calls 1

SearchFunction · 0.85

Tested by

no test coverage detected