EINTR and simple main loop?
Thiago Macieira
thiago at kde.org
Tue Aug 5 00:53:27 PDT 2008
On Tuesday 05 August 2008 09:26:42 Markku Savela wrote:
> I needed a simple DBus based service, which needed to manage some
> child processes. I didn't want to spend too much time on DBus details,
> so I used the simplest main loop
>
> while (dbus_connection_read_write_dispatch(...))
> {
> something();
> }
>
> Because messing with complex data structures in signal handler is
> problematic, I just set simple global flags that something has
> changed, and wanted to do the actual "cleanup" in the "something()".
>
> However, the event loop does not appear to "cycle" on signals (EINTR).
>
> Is there any simple way to get this happen? Or, is the only way to
> make my own event loop?
Write your own, full event loop. From your signal handler, write a byte to a
pipe. And put that pipe in the same select/poll call that you use to check the
D-Bus socket.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080805/fde099d9/attachment.pgp
More information about the dbus
mailing list