I have a question regarding C++ coding conventions for threads.
Now, I know that when writing thread-safe code, any kind of static is generally a bad idea, unless you wrap those variables in mutexes.
However, at the highest level of the application, it seems convenient to have access to static class methods or static class data members which do high-level functions like keep track of pthread_t structs, or flagging when the main thread wants to exit (which baby threads can check).
Is the use of static in this kind of context ok? If not, is there a better or cleaner way of accomplishing the same in C++? What is conventional?
Apparently, a lot of refactoring may be needed, but it seems much easier to control access (and to wrap with mutexes) once everything is non-static. Encapsulation is a good thing.