Commit a5c51278 authored by Ralf Habacker's avatar Ralf Habacker

Eliminates a race condition accessing DBusBabysitter instance at startup of...

Eliminates a race condition accessing DBusBabysitter instance at startup of babysitter() on Windows.

Ensure that the babysitter thread already owns its one reference to the
babysitter when it starts up, and eliminates the race condition.
This patch requires that DBusBabysitter refcounting is thread-safe
and is based on an analysis and proposal of Simon Mc Vittie.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=95191Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 5ef167c1
......@@ -586,8 +586,6 @@ babysitter (void *parameter)
DBusBabysitter *sitter = (DBusBabysitter *) parameter;
PING();
_dbus_babysitter_ref (sitter);
if (sitter->child_setup)
{
PING();
......@@ -728,7 +726,7 @@ _dbus_spawn_async_with_babysitter (DBusBabysitter **sitter_p,
PING();
sitter_thread = (HANDLE) CreateThread (NULL, 0, babysitter,
sitter, 0, &sitter_thread_id);
_dbus_babysitter_ref (sitter), 0, &sitter_thread_id);
if (sitter_thread == 0)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment