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

List:       freedesktop-dbus
Subject:    Re: Pending Calls and Asynchronous functions
From:       Havoc Pennington <havoc.pennington () gmail ! com>
Date:       2010-04-14 2:51:34
Message-ID: h2m2cef5bf41004131951j54eb9875y52dc7f128574d857 () mail ! gmail ! com
[Download RAW message or body]

It seems like a fairly simple patch to add send_with_reply_notify
where the notify callback is passed in and set on the pending call
while locks are still held

Havoc

On Thu, Mar 25, 2010 at 5:07 AM, Alexander Larsson <alexl@redhat.com> wrote:
> On Wed, 2010-03-24 at 09:51 -0700, jaikumar Ganesh wrote:
>> Hello folks,
>>
>> On Tue, Mar 23, 2010 at 3:52 PM, jaikumar Ganesh <jaikumarg@gmail.com>
>> wrote:
>>         Hello folks,
>>             I have the following calls:
>>
>>
>>                        reply = dbus_connection_send_with_reply(conn,
>>         msg, &call,
>>
>>                          timeout_ms);
>>                        if (reply == TRUE) {
>>
>>         dbus_pending_call_set_notify(call,
>>
>>         callback,
>>
>>         pending,
>>
>>         NULL);
>>                        }
>>
>>
>>         So I get a reply from the other end (very quickly) and before
>>         a pending function can get set in
>>         dbus_pending_call_set_notify.
>>         And thus when _dbus_pending_call_complete is called I don't
>>         get the callback because pending->function is NULL.
>>
>>         This is a race condition and I hit it 50 % of the times
>>         depending on how loaded the system is.
>>
>>
>>         Is there a better way to set the pending call ? Am I using it
>>         wrongly ?
>>
>>         Thanks
>>         Jaikumar
>>
>>    I see a similar thread way back
>> http://marc.info/?l=freedesktop-dbus&m=117323278532868&w=2
>>    Did we dix this ?
>
> I don't think so. I have a workaround in gvfs:
>
> http://git.gnome.org/browse/gvfs/tree/common/gdbusutils.c#n1316
>
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>  Alexander Larsson                                            Red Hat, Inc
>       alexl@redhat.com            alexander.larsson@gmail.com
> He's a jaded flyboy cop moving from town to town, helping folk in trouble.
> She's a ditzy nymphomaniac lawyer with only herself to blame. They fight
> crime!
>
> _______________________________________________
> dbus mailing list
> dbus@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
_______________________________________________
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