libatspi and event processing



Hello everyone,

Currently, I'm developing small C application using libatspi and encountered some problems with event processing.

What I have is two event listeners A and B registered with atspi_event_listener_register() on different at-spi events. Inside main loop assume that A listener can invoke callback a() on some atspi event. Inside a() callback there are some calls to atspi_accessible_get_* functions.

What I have noticed is that calling functins like. atspi_accessible_get_name() triggers further dbus events processing what result in different listeners to be invoked. As the result code of b() callback can be invoked (and sometimes is in my application) during execution of a() callback code.

I find this very inconvenient because every atspi_accessible_get_* related call in callback a() have to be wrapped with some 'rollback' logic in my application, because events of listener B can occur.

So my questions are:

1. What is a preferred way of handling such cases? I want every callback to process sequentially and not to introduce new race conditions in my application. Such APIs makes my code hard to write because "everything can happen everywhere". 2. Shouldn't it be better to dispatch all deferred events when main loop enters idle state? Mayby there is a reasoning for such design that I'm not familiar of.

Thanks for any feedback
Best regards
Lukasz Stanislawski


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]