Hello! I have a couple of functions that MUST share a single variable. These functions will be compiled into a dynamic library (.so) and this library will be accessed by multiple threads. Is this method thread-safe, or I must use mutexes to prevent corruption of the global variable?
Code:// foo.h void foo1(); void foo2();Thanks any help!Code:// foo.cpp static int foo_flag = 0; void foo1() { // uses foo_flag } void foo2() { // uses foo_flag }