Refactor CallQueue flushing for clarity
This commit is contained in:
parent
ada712e06a
commit
c85beb8106
2 changed files with 59 additions and 53 deletions
|
@ -222,11 +222,7 @@ void CallQueue::_call_function(const Callable &p_callable, const Variant *p_args
|
|||
}
|
||||
}
|
||||
|
||||
Error CallQueue::flush() {
|
||||
LOCK_MUTEX;
|
||||
|
||||
// Thread overrides are not meant to be flushed, but appended to the main one.
|
||||
if (this == MessageQueue::thread_singleton) {
|
||||
Error CallQueue::_transfer_messages_to_main_queue() {
|
||||
if (pages.size() == 0) {
|
||||
return OK;
|
||||
}
|
||||
|
@ -278,6 +274,14 @@ Error CallQueue::flush() {
|
|||
return OK;
|
||||
}
|
||||
|
||||
Error CallQueue::flush() {
|
||||
// Thread overrides are not meant to be flushed, but appended to the main one.
|
||||
if (unlikely(this == MessageQueue::thread_singleton)) {
|
||||
return _transfer_messages_to_main_queue();
|
||||
}
|
||||
|
||||
LOCK_MUTEX;
|
||||
|
||||
if (pages.size() == 0) {
|
||||
// Never allocated
|
||||
UNLOCK_MUTEX;
|
||||
|
|
|
@ -98,6 +98,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
Error _transfer_messages_to_main_queue();
|
||||
|
||||
void _add_page();
|
||||
|
||||
void _call_function(const Callable &p_callable, const Variant *p_args, int p_argcount, bool p_show_error);
|
||||
|
|
Loading…
Reference in a new issue