
Compile time define for checking threadsafe flag of functions

thomas_braun
I have some code which does
Function DoStuff() Multithread data[] = FuncTS() End ... threadsafe static Function FuncTS() // do stuff End
As FuncTS is a bit difficult to understand I would like to add some debugging output for easy testing (testing would be done without Multithread/threadsafe keywords). Unfortunately that debugging output requires non-threadsafe functions.
Is there a way to have two code paths in the function? One for threadsafe and one for non-threadsafe?
Something like
threadsafe static Function FuncTS() #ifndef FUNCTION_IS_THREADSAFE // debug output #endif End
Another solution would be if threadsafe and non-threadsafe functions could be overloaded but I'm not sure that this would be a good thing.