thread locking

Havoc Pennington hp at
Sun Feb 13 12:31:22 PST 2005


I've been trying to make threaded usage really work; I'm not an expert
here, but I think it's a little bit better.

If someone is good at this sort of thing and wants to play with dbus-
connection.c please go for it.

The way I *think* it works now is:

 - all DBusConnection calls hold a big connection lock
 - this lock is dropped whenever libdbus calls out to the application,
   while blocking in poll()
 - to allow the big connection lock to be dropped without causing
problems, there
   are two sub-locks:
    - one around popping messages from the front of the incoming message
      (aka dispatch)
    - one around reading/writing from the socket (io path)
 - to acquire/release either of the two sub-locks you must have the big
connection lock,
   but you can hold these sub-locks while dropping the big lock (that's
the point of them)

I don't have much experience with this sort of thing though.


More information about the dbus mailing list