forked from enlightenment/efl
efl_message: add pending queue for filtering message.
Sometimes message is appended when message queue is walking. In this case, newly added messages are not filtered. So I add message pending queue for filtering message. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10459
This commit is contained in:
parent
b8ba39f4cb
commit
b2ee3ad748
|
@ -147,6 +147,7 @@ struct _Efl_Loop_Data
|
|||
Eina_List *thread_children;
|
||||
|
||||
Eina_Inlist *message_queue;
|
||||
Eina_Inlist *message_pending_queue;
|
||||
unsigned int message_walking;
|
||||
|
||||
unsigned int throttle;
|
||||
|
|
|
@ -621,6 +621,14 @@ _efl_loop_message_process(Eo *obj, Efl_Loop_Data *pd)
|
|||
}
|
||||
else free(msg);
|
||||
}
|
||||
|
||||
while (pd->message_pending_queue)
|
||||
{
|
||||
msg = (Message *)pd->message_pending_queue;
|
||||
pd->message_pending_queue = eina_inlist_remove(pd->message_pending_queue,
|
||||
pd->message_pending_queue);
|
||||
pd->message_queue = eina_inlist_append(pd->message_queue, EINA_INLIST_GET(msg));
|
||||
}
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
|
|
@ -54,8 +54,16 @@ _efl_loop_message_handler_message_send(Eo *obj, Efl_Loop_Message_Handler_Data *p
|
|||
{
|
||||
msg->handler = obj;
|
||||
msg->message = message;
|
||||
pd->loop_data->message_queue = eina_inlist_append
|
||||
(pd->loop_data->message_queue, EINA_INLIST_GET(msg));
|
||||
if (pd->loop_data->message_walking > 0)
|
||||
{
|
||||
pd->loop_data->message_pending_queue = eina_inlist_append
|
||||
(pd->loop_data->message_pending_queue, EINA_INLIST_GET(msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->loop_data->message_queue = eina_inlist_append
|
||||
(pd->loop_data->message_queue, EINA_INLIST_GET(msg));
|
||||
}
|
||||
_efl_loop_message_send_info_set(message, EINA_INLIST_GET(msg),
|
||||
pd->loop, pd->loop_data);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue