Thread synchronization

  • Thread starter Thread starter Giulio Petrucci
  • Start date Start date
G

Giulio Petrucci

Hi there,

I have two threads:
- thread A: write some data into a stream (audio on an audio card,...etc...)
- thread B: listen for an event (mouse click,...)
I need to stop A when the event B's listening to occures.

Please, could anyone help me?

Thanks in advance,
Giulio - Italia
 
Maybe i have misunderstood, but i presume an event fires that tells Thread B
to start? And you want Thread A to stop when thread B starts? So stop Thread
A when the event that triggers B to start fires? have i misunderstood you
here?

Also if they will not run simulatenously, why the need to run them on
separate threads in the first place?
 
Hi PokerMan,

PokerMan ha scritto:
Maybe i have misunderstood, but i presume an event fires that tells Thread B
to start?

Maybe. ;-)
Also if they will not run simulatenously, why the need to run them on
separate threads in the first place?

Because they're using currently two different HW resources.

Bye,
Giulio

--
 
Hi Bruce,

Bruce Wood ha scritto:
Have B's event listener set a boolean flag in the object that contains
the code for A. Then have A poll (test) the flag at regular intervals,
say before each write.

I see.
So the only way is to use a buffer for writing data.

Thanks for your suggestion!
Giulio - Italia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top