I recently started using C++ instead of Delphi. And there are some things that seem to be quite different. For example I don't know how to initialize variables like Semaphores and CriticalSections. By now I only know 2 possible ways: 1. Initializing a Critical Section in the constructor is stupid since every instance would be using its own critical section without synchronizing anything, right? 2. Using a global var and initializing it when the form is created seems not to be the perfect solution, as well. Can anyone tell me how to achieve this?
Just a short explanation for what I need the Critical Section : I'd like to fill a ListBox from different threads. The Semaphore : Different threads are moving the mouse, this shouldn't be interrupted.
Thanks!