dbus questions

David Zeuthen david@fubar.dk
Tue, 09 Dec 2003 19:53:02 +0100


On Tue, 2003-12-09 at 17:23, Gordon Tyler wrote:
> I get the impression that this is not within D-BUS' domain. It's an 
> application-level requirement which you could probably achieve without 
> multi-threading by using a queue-like system:
> 
> 1. You receive message A but you determine that it requires message B to 
> be processed first. You push it onto the queue, making a note of its 
> dependencies and continue listening for messages.
> 2. You receive message B but you determine that it requires message C to 
> be processed first. You also push it onto the queue and continue 
> listening for messages.
> 3. You receive message C that has no dependencies. You process it:
>     a. You search through the queue in most-recent-to-oldest order, 
> looking for a message that depends on the message being processed, 
> finding message B.
>     b. Having found message B, you make a note in the message that it's 
> message C dependency has been satisified.
>     c. Since message B has had all its dependencies satisfied, you 
> process it as above.
>     d. Continue searching for a message which depends on message C.
> 
> Or something along those lines. Some provision would have to be made to 
> keep track of situations like message C arriving first.
> 

Yeah, you're right this is the way to do it. I'll try to hack something
together - if I make it generic enough we could include it in D-BUS as I
can imagine a number situations stuff like this is useful.

It was also a question of whether multi-threading at all was possible /
easy to do with D-BUS. I know that it's possible and easy in ACE with
their Reactor stuff and thread-pools for message listeners.

Thanks,
David