Problems with dbus_fake_mutex

Alexander Larsson alexl at redhat.com
Thu Nov 23 02:52:44 PST 2006


On Thu, 2006-11-23 at 10:28 +0100, Christian Ehrlicher wrote:
> Von: Alexander Larsson <alexl at redhat.com>
> > On Thu, 2006-11-23 at 09:49 +0100, Christian Ehrlicher wrote:
> > > Hello,
> > > 
> > > During our work on the win32 port, we found a problem with
> > > dbus_fake_mutex_foo() - functions. Because they're only fake
> > > functions, it is possible that one thread looks something and another
> > > thread wants to access the locked variable. Instead waiting for
> > > unlock, the thread throws an assert().
> > > Now I wonder why you added those fake mutexes. You should get the same
> > > problems on linux too (not that often because we use more locks)...
> > 
> > You can't use the fake mutexes with actual threads. If you use threads
> > you *have* to initialize dbus with thread support.
> > 
> > The fake mutexes are there to use in tests to detect bugs like
> > deadlocks.
> > 
> But wouldn't it be better to use another ifdef than DBUS_BUILD_TESTS to enable the fake mutexes?

Well, they are clearly useless unless you're running tests. Are the
win32 tests using threads?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl at redhat.com    alla at lysator.liu.se 
He's an old-fashioned drug-addicted paramedic for the 21st century. She's a 
sharp-shooting Bolivian widow looking for love in all the wrong places. They 
fight crime! 



More information about the dbus mailing list