strcmp(variable, "constant");
Or do I need to protect it with a mutex?
If a variable can be modified by another thread, you must protect it. No magic here - higher-level languages ββcan perform such a function call atomically, and this is βmagicβ not present in C.
, ( ) "variable" ( ), ( : ). strcmp, .
, .
strcmp , variable, , "" , , , .
strcmp
variable
, ., strcmp, ( ), strcmp 2 ., variable , strcmp , strcmp , variable.
. , , .
Have a look here: http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html
POSIX has a list of unsafe functions. Accordingly, at least on POSIX it strcmp()will be thread safe.
strcmp()
Source: https://habr.com/ru/post/1778699/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1778694/using-loop-invariants-to-prove-the-correctness-of-heap-sort&usg=ALkJrhhdTMeasCl32e315z7g6LGavGCutwWhy doesn't it work, as I expect here? - bashI again have a problem with protobuf.net - c #Running a search robot for selected sites in the Google App Engine? - google-app-engineSQL Server text, text type, image data type - sql-serverAndroid stream data recording efficiency - androidGive a different value for input - javaAccess to a model object from multiple controllers? - objective-cGet Maven Runtime Status in a Shell - ShellSet the _layouts page as your homepage in Sharepoint 2010 - sharepoint-2010All Articles