[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: coroutine vs threads
- From: Florian Weimer <fw@...>
- Date: Sun, 17 Jul 2011 16:25:15 +0200
* Gaspard Bucher:
> I do not think I could use your suggestion of a centralized event loop. What
> happens with zmq requests for example ? These are synchronous calls that
> cannot easily be "posted" as events. I will investigate further to see how I
> could integrate things like "mdns", "zmq" and Qt in a single event loop: a
> single "select" without mutex seems like the obvious choice but I'm not sure
> I can force ZeroConf and ZeroMQ into Qt slavery.
There's an entry about this in the ZeroMQ FAQ:
| How can I integrate ØMQ sockets with normal sockets? Or with a GUI
| event loop?
|
| You can use the zmq_poll() function to poll for events on both ØMQ and
| normal sockets. The zmq_poll() function accepts a timeout so if you
| need to poll and process GUI events in the same application thread you
| can set a timeout and periodically poll for GUI events. See the
| zmq-camera example for a demonstration.
<http://www.zeromq.org/area:faq>
This doesn't look too good.
But further below, there's this hint:
| Note that there's a way to retrieve a file descriptor from ØMQ
| socket (ZMQ_FD socket option) that you can poll on from version 2.1
| onwards, however, there are some serious caveats when using
| it. Check the documentation carefully before using this feature.
I'm pretty sure that there's a way to do this because it appears to be
a commonly requested ZeroMQ feature.
Do you use any other libraries which involve blocking calls, similar
to ZeroMQ?