[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: Proper use of dbus_connection_send_with_reply & DBusPendingCall
From:       Thiago Macieira <thiago () kde ! org>
Date:       2007-12-28 0:26:50
Message-ID: 200712272226.51299.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


David Belser wrote:
>1 - I will be handling the reply in a different thread than the one
>that made the call, this may or may not be that big of an issue
>depending on how and what my app is doing.
>
>2 - There is a brief window where the dispatch thread may receive the
>reply before I've set the callback notify function.

There's a simple solution to both cases: only access the DBusConnection 
from one thread. Your application can be multi-threaded, but you don't 
have to make concurrent accesses to the DBusConnection object.

Since you're talking about a binding, it shouldn't be too difficult to 
wrap those concepts.

However, there is also a drawback: the dispatching thread has to be 
available. Either it's a dedicated thread for that job or it's a thread 
that you guarantee not to block on expensive operations. If it's not a 
dedicated thread, you have to worry about deadlocks as well (dipatching 
thread calls aux thread that tries to access D-Bus).

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["signature.asc" (application/pgp-signature)]

_______________________________________________
dbus mailing list
dbus@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dbus


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic