i have one c code file that is responsible for creating, starting and controlling a poll of threads. when a thread is called it calls a function included in a seperate c code file.
so, this function is called by many threads. i thought this method (seoperation of files) would cause each thread to call a different instance of that function.
it now seems obvious that the present method is the same as including all the code in the same file. this causes problems with the threads having access to the same global variables.
i don't want mutual exclusion, but complete exclusion. i.e. different instances of the second file being called like in OO programming.
is there an easy method of doing this?
how is this achieved in standard libraries?