Dbus calls interlock issue

Kaustubh Atrawalkar kaustubh.ra at gmail.com
Sun Feb 15 00:39:57 PST 2009


Will threading works here? In signal handler, i will create a pthread with a
function and parameter as pid and the sig_handler returns. The thread does
it cleanup and gconf calls and closes safely. Will it block the server in
any way? Is it safer to make calls from thread?

Cheers,
- Kaustubh (aka. Silverroots)
[www.kaustubh.org]



On Sat, Feb 14, 2009 at 3:05 AM, Thiago Macieira <thiago at kde.org> wrote:

> Scott James Remnant wrote:
> >On Fri, 2009-02-13 at 15:50 +0000, Simon McVittie wrote:
> >> One of the few safe things to do is write the pid to a pipe (as in
> >> pipe(2)) and return; whenever a pid can be read from the other end of
> >> the pipe in your main loop, do your cleanup and D-Bus interactions
> >> there.
> >
> >Though note that if you spawn a large number of children, it is possible
> >for this pipe to be filled such that the signal handled blocks on
> >write()
> >
> >It's generally better to use pselect() or ppoll() and otherwise mask
> >SIGCHLD out from your process.
>
> pselect wasn't available on Linux until very recently.
>
> You should make your pipe non-blocking. If it's full, the event loop is
> going to wake up anyways very soon now.
>
> --
>  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
>    PGP/GPG: 0x6EF45358; fingerprint:
>    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20090215/036c599b/attachment.html 


More information about the dbus mailing list