Problems with dbus_fake_mutex

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Thu Nov 23 02:56:38 PST 2006


An: Christian Ehrlicher <Ch.Ehrlicher at gmx.de>
> 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?
> 
Yes, we run bus-test which is using threads and got asserts all the time because of an assert inside fake_mutex. We had to use the real mutex implementation to get to the real problems.

Christian
-- 
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!


More information about the dbus mailing list