I have an application that is getting bigger and bigger and application threads are running wild. someone told me to use semaphore to syncronize them.
for instance, i have thread1, thread2, thread3, thread4, ..... thread22.
i want thread2 to wait on 1 and I want thread 3 to wait on thread2. I want threads 15-22 to wait on thread7 , then thread8 wait on thread22 got the picture?, why make them threads, because each one is responsible for a specific HW.
my questions are:
-->could I use semaphore for this, or is there a better way
------->if semaphore will do the job, is there somewhere i can learn they quick, how-to, tutorial, examples, etc etc?
-------> if ! what can I use?
ps. the order of threads might change, I could stop thread2, then thread3 will wait for thread1.