[PATCH] Re: Threading problems in (Win)DBus

Olivier Hochreutiner olivier.hochreutiner at gmail.com
Tue Jul 10 08:53:04 PDT 2007


>
> Good catch, I would do the patch differently:
>   - leave all the stuff protected by connection->mutex as bitfields,
>     including the have_connection_lock flag
>   - move dispatch_acquired and io_path_acquired down below the bitfields
>     and make them dbus_bool_t instead of bitfields
>
> This is an opaque struct so there is no binary compat concern.
>
> Only 8 bytes more should be needed, since there's no problem with the
> bit fields in general, only with the two flags protected by a different
> lock, right?
>
> I would also put a small comment before the two dbus_bool_t like
> "/* not a bitfield because all bits in a bitfield must be protected by
> the same mutex */"
>
> If these changes make sense to you I will just make them, it isn't
> necessary to redo the patch.

Fine with me. I just removed the bit field completely in my patch
because I was not sure of which variable was protected by which lock
(ok I admit I was lazy to check ;-)


>
> Thanks for the fix, I would not have found this very quickly ;-)

You're welcome. In fact I just remarked now that if
DBUS_DISABLE_CHECKS is defined the problem does not occur, because
have_connection_lock is not defined in this case. Of course there
would still be a risk between dispatch_acquired and io_path_acquired.

Olivier


More information about the dbus mailing list