Page MenuHomePhabricator

EO event deletion with priority
Open, Incoming QueuePublic


The idea of this is to allow the deletion of events with a priority.

What right now happens:

  • We get a deletion call with obj, cb, data. We linear walk down the list of callbacks, and delete the first finding of a subscription that meets obj, cb, data parameters.

Problem with that:

A user could add a callback twice with the same data with 2 different priorities, now only the first priority will be deleted, (note: the list is sorted by the priority)

What we could do:

Add a priority to those calls:
We start to walk the list of subscriptions like before, but we don't do anything until we are at a subscription where the priority is >= to the one supplied, then we safe this spot, continue to search for a matching subscription, when we are at the end, we are rolling over to index 0, continuing to the spot that we have safed.

For API usages where we don't have a priority, we can just insert the smallest priority, which will end up in the same behaviour as before. However, we provide the user with a API for the usecase he uses 2 different priorities.

bu5hm4n created this task.Thu, Jan 3, 1:56 AM
cedric added a comment.Thu, Jan 3, 4:04 PM

We might actually have a bigger problem with D7532 as @segfaultxavi point out, Efl_Callback_Priority is not defined in a .eo and invisible to bindings. I am leaning toward restricting it to just an enum with before, default and after. But maybe there is something better to be done.

Eolian seems to support types, so something like type Efl_Callback_Priority : short; should work for the type. For the type we can just define a few constants like: const MAX_PRIORITY : Efl_Callback_Priority = 5; I think things should work with this :)

D7532 has already defined Efl.Callback_Priority in EO, so the above concerns have been addressed.

The addition of an event_callback_forwarder_priority_del method makes sense to me. I do not understand the proposed mechanism to walk the list to find the priority, though. Isn't it enough to just remove the first callback in the list with matching obj, cb, data AND priority?