Yes, I'm not as experienced as I'd like to be, and this will sound elementary to many, but I want to ask about programming concerns in a multi-threaded application. I understand the concept of using a lock (semaphore) on a variable that will be accessed by more than one thread, but what about a block of code? So, let's say that there is a function called TestMe(int tst) that is called in multiple threads. Let's say that one thread calls the function, and in the middle of processing the function's code, the same function is called by a second thread. Is there a danger in this? I realize that the code is just a series of instructions, and I'm guessing that the set of instructions exist only once the application's code. The variables created in the function are created on the stack, so when the function is called in the second thread, its variables would be created on the stack of the second thread and therefore be separate from those created by the first thread, correct?. The only danger I see is where global variables are used by the function, which would be managed by the semaphore, or a case of static variables declared in the function. Is a static variable created in the thread space or in the global space? Am I thinking on the right track, or am I off-base?
Thanks!