0

Hello:

I am trying to create an audio processor, and I have a program that creates some threads (in Windows). The "main" program creates the audio processor thread, and then creates the audio reader thread. I would like to know how the audio reader can tell the processor that the audio has finished. I have tried with events, but (correct me if I am wrong) when using events a thread has to wait until the other sets the event; and it is not may case, because in my processor thread the processor is working inside a loop that has to check if the audio-picking has finished; if not, it continues working.

Any help...?

Thank you,

Xagutxu

3
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by Narue
0

You do not have to wait to see if an event is set. You can test the event without waiting if you call something like WaitForSingleObject with the dwMilliseconds parameter set to 0 then the function will return immediately indicating if the event signalled or not at that time.

Edited by Banfa: n/a

0

If these are threads within the same process as opposed to threads in different processes, you can use a thread-safe data structure to share these signals. In my opinion that's easier than implementing an inter-process communication mechanism just for threads.

0

Thank you for answering so quickly...

Could you tell me wether there is any structure or method in C++ to manage with those thread-safe data structure?

Thank you again,

Xagutxu

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.