On Tue, Dec 21, 2010 at 01:17:27PM -0700, AJ ONeal <[email protected]> wrote:
> My current solution is to create a thread and a nasty global called
> dsp_ready.
> If the idle event occurs but dsp_ready is 0, then it will simply sleep 1ms
> and return.
> The dsp function changes dsp_ready when it starts and is done processing.
> 
> Please point me to an example of the proper way to do this.

I am not completely sure I understand you, but maybe it's this:

- your dsp doesn't offer a file descriptor you could check for activity
  (if it's a character device for example, it might have one)
- you want to do something when the dsp is ready

The solution would indeed involve a second thread which does whatever it nees
to do to talk with the dsp. You would start an async watcher in your main
thread, and when the second thread detects some activity, it ev_async_send's
to the async watcher.

This will wake up the event loop and cause your async watcher callback to
be invoked.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      [email protected]
      -=====/_/_//_/\_,_/ /_/\_\

_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to