[SOLVED] opening many threads and waiting for certain event

Status
Not open for further replies.

syedshan

Advanced Member level 1
Joined
Feb 27, 2012
Messages
463
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,308
Location
Jeonju, South Korea
Activity points
5,134
hello every one,

I need to open more than 500 threads and each thread (except for the one I call the master thread, although it is the same PARALLEL thread with others).
Total "500 + 1" threads

I want my master thread to receive data from DMA, then activate something in the other threads. Where I copy data using memcpy() to the buffer in that thread. and then in the mean time, the next data comes from DMA in the master thread, which activates the other file-saving thread and so on...

(note that each thread correspond to each file-saving-thingy, hence 500 files).

I really am messed up for two days reading loads of material over threads (in c++) mainly starting from createthreads() and going on and on, I thought the WaitForSingleObject might be solution but I cannot understand how to implement this...

any idea would be appreciable. I do not seek any code, I just seek the way to implement. For example those familira with VHDL, they might know in VHDL we can use
Code:
wait until abc'event and abc = '1';

but what to do here?

thanks
Shan
 

well we can do that in several ways, for exampl WaitForSingle event or WaitForMultiple event or the function who is calling the calling after the CreateThread() statement infinite while loop as shown below.

Code:
while(1) {

//if(certain global flag triggers)
break;
}

Shan
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…