Example of custom backend with thread?

AJ ONeal coolaj86 at gmail.com
Tue Dec 21 21:17:27 CET 2010

I have a function to process data on a DSP which blocks
and a network socket which gives data to process.

I have the event loop such that once a client has sent all data (and it is
copied into a buffer) it starts the idle watcher (if not already started),
which contains the call to the DSP function.

Yet while the DSP is crunching I want to still be able to accept new data.

My current solution is to create a thread and a nasty global called
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.

AJ ONeal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20101221/cbb30922/attachment.html>

More information about the libev mailing list