I have two (or more threads) working parallel. Their purpose is to measure hardware devices and they rely on a external hardware stimulus. At a certain point during execution, they trigger an hardware device and wait for the stimulus. But I have only one stimulus device.
Therefore the threads have to wait, till every thread is ready to receive the stimulus. Now another thread (maybe the dispatching main-thread) has to trigger the device and the threads can go on.
What is best practice to synchronise this? Preferable with a dynamic number threads?
EDIT: We use CVI/Labwindows. That offers some threading but mostly through bad documented macros. I have figured out, how to register threads, start them and wait for them to finish.
There also seems to be tools to create threadsafe variables and locks. But their syntax eludes me, therefore I want/need to build some kind of mutex/semaphore myself.