MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / CheckPosixThreading

Function CheckPosixThreading

engine/3rdparty/tinyobjloader/deps/cpplint.py:1911–1934  ·  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

1909
1910
1911def CheckPosixThreading(filename, clean_lines, linenum, error):
1912 """Checks for calls to thread-unsafe functions.
1913
1914 Much code has been originally written without consideration of
1915 multi-threading. Also, engineers are relying on their old experience;
1916 they have learned posix before threading extensions were added. These
1917 tests guide the engineers to use thread-safe functions (when using
1918 posix directly).
1919
1920 Args:
1921 filename: The name of the current file.
1922 clean_lines: A CleansedLines instance containing the file.
1923 linenum: The number of the line to check.
1924 error: The function to call with any errors found.
1925 """
1926 line = clean_lines.elided[linenum]
1927 for single_thread_func, multithread_safe_func, pattern in _THREADING_LIST:
1928 # Additional pattern matching check to confirm that this is the
1929 # function we are looking for
1930 if Search(pattern, line):
1931 error(filename, linenum, 'runtime/threadsafe_fn', 2,
1932 'Consider using ' + multithread_safe_func +
1933 '...) instead of ' + single_thread_func +
1934 '...) for improved thread safety.')
1935
1936
1937def CheckVlogArguments(filename, clean_lines, linenum, error):

Callers 1

ProcessLineFunction · 0.85

Calls 2

SearchFunction · 0.85
errorFunction · 0.50

Tested by

no test coverage detected