After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 559168 - Make parent wait for initialization in children to finish before returning
Make parent wait for initialization in children to finish before returning
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2008-11-03 19:10 UTC by Behdad Esfahbod
Modified: 2010-03-24 18:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the patch (2.17 KB, patch)
2008-11-03 19:12 UTC, Behdad Esfahbod
committed Details | Review
change to use signal to terminate parent process (662 bytes, patch)
2009-02-20 07:47 UTC, soulxu
none Details | Review

Description Behdad Esfahbod 2008-11-03 19:10:09 UTC
Such that we set all the settings before other applications are started.
Comment 1 Behdad Esfahbod 2008-11-03 19:12:14 UTC
Created attachment 121901 [details] [review]
the patch
Comment 2 Jens Granseuer 2008-11-03 21:27:31 UTC
+		(void) chdir ("/");

The (void) should go if it doesn't work anyway.

Indentation again, and maybe also add a comment why you don't simply daemonize before gtk_main.
Comment 3 Behdad Esfahbod 2008-11-03 21:45:01 UTC
Added comments and committed.

2008-11-03  Behdad Esfahbod  <behdad@gnome.org>

        * gnome-settings-daemon/main.c (daemonize), (main):
        Make parent wait for initialization in children to finish before
        returning.  This makes gnome-session to wait for initialization
        to be done before spawning other processes.  This way, apps
        start up with the right xsettings and other settings, and don't
        have to handle change signals right after starting up. (bug #559168)

Comment 4 Behdad Esfahbod 2008-11-04 08:13:53 UTC
Ok, after some testing, I figured the kill+wait scheme doesn't work.  Fixed using a pipe.

2008-11-04  Behdad Esfahbod  <behdad@gnome.org>

        * gnome-settings-daemon/main.c (daemonize), (main): Use a pipe
        to communicate between child and parent process instead of a
        signal.  Signals are not queued, so if the child tried to signal
        the parent before the parent got a chance to wait for it, the signal
        would be lost and parent wait indefinitely for a signal that would
        never arrive.

Comment 5 soulxu 2009-02-20 07:47:26 UTC
Created attachment 129129 [details] [review]
change to use signal to terminate parent process

waitpid can not return when receiving the signal of SIGCHLD. Change to use signal to terminate parent process.
Comment 6 Jens Granseuer 2009-02-20 19:11:33 UTC
Can you please elaborate what problem you are seeing that you are trying to fix? And please provide patches against trunk. 2.24.x is in maintainance mode.
Comment 7 Jens Granseuer 2009-02-20 19:12:19 UTC
And please file new bugs instead of raising long-dead ones in the future. Thanks.
Comment 8 Tobias Mueller 2010-03-24 18:19:29 UTC
Closing as FIXED since patches have been written and committed. Feel free to revert.