thread locking

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


Hi,

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,
and 
   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
queue
      (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.

Havoc




More information about the dbus mailing list