Can anyone help me to invoke or link those threads or make threads wait on the semaphore created?
For example, I create 10 threads, I need to make these threads wait on a semaphore and whenever a semaphore signals, one thread should be pciked.
In the example 10 threads are created. How will I use semaphores to signal anyone of these threasd?
DWORD WINAPI TT1();
for(int i=0; i<10;i++)
hMyThread[i] = CreateThread(NULL, 0,(LPTHREAD_START_ROUTINE)TT1,
NULL, 0, &MyThreadID[i]);
threadid = *(&MyThreadID[i]);
cout<< "threadid" << threadid <<endl;
cout<< "threadid" << *(&MyThreadID[i]) <<endl;
DWORD WINAPI TT1()
cout << "In TT1 - Thread Created" <<endl;
Any help appreciated.
Please let me know