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

List:       freedesktop-dbus
Subject:    Re: implementing IN_PROGRESS
From:       Thiago Macieira <thiago.macieira () trolltech ! com>
Date:       2006-02-26 12:10:01
Message-ID: 200602261310.09292.thiago.macieira () trolltech ! com
[Download RAW message or body]


Havoc Pennington wrote:
>On Sun, 2006-02-26 at 02:56 +0100, Thiago Macieira wrote:
>> >There are several ways I can think of that a handler would know it's
>> >being called the first time or the second time; any thoughts on that?
>>
>> I think the most inobtrusive way to do this is to overload
>> dbus_connection_add_filter into dbus_connection_add_filter2 that takes
>> two functions as parameters. The second one would be called when the
>> lock has been released.
>
>Another possible approach is that you could track it via the user_data,
>e.g. you'd have a flag in user_data for "I just returned
>PARTIALLY_HANDLED" - I don't know what you're using user_data for
>already so maybe this is not good, depending.

That requires a stateful approach and I'd rather avoid that.

user_data is shared among threads. So, if another thread is waiting for 
the dispatch lock to be released, the filter could be called again for a 
new message before the continuation handler were called. I could add a 
semaphore to avoid that, but I'd rather not to, if possible.

-- 
Thiago José Macieira - thiago.macieira AT trolltech.com
Trolltech AS - Sandakerveien 116, NO-0402 Oslo, Norway

[Attachment #3 (application/pgp-signature)]

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

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