/**************************************************************************/ /* message_queue.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #include "message_queue.h" #include "core/config/project_settings.h" #include "core/object/class_db.h" #include "core/object/script_language.h" #include <stdio.h> #ifdef DEV_ENABLED // Includes safety checks to ensure that a queue set as a thread singleton override // is only ever called from the thread it was set for. #define LOCK_MUTEX … #else #define LOCK_MUTEX … #endif #define UNLOCK_MUTEX … void CallQueue::_add_page() { … } Error CallQueue::push_callp(ObjectID p_id, const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error) { … } Error CallQueue::push_callp(Object *p_object, const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error) { … } Error CallQueue::push_notification(Object *p_object, int p_notification) { … } Error CallQueue::push_set(Object *p_object, const StringName &p_prop, const Variant &p_value) { … } Error CallQueue::push_callablep(const Callable &p_callable, const Variant **p_args, int p_argcount, bool p_show_error) { … } Error CallQueue::push_set(ObjectID p_id, const StringName &p_prop, const Variant &p_value) { … } Error CallQueue::push_notification(ObjectID p_id, int p_notification) { … } void CallQueue::_call_function(const Callable &p_callable, const Variant *p_args, int p_argcount, bool p_show_error) { … } Error CallQueue::flush() { … } void CallQueue::clear() { … } void CallQueue::statistics() { … } bool CallQueue::is_flushing() const { … } bool CallQueue::has_messages() const { … } int CallQueue::get_max_buffer_usage() const { … } CallQueue::CallQueue(Allocator *p_custom_allocator, uint32_t p_max_pages, const String &p_error_text) { … } CallQueue::~CallQueue() { … } ////////////////////// CallQueue *MessageQueue::main_singleton = …; thread_local CallQueue *MessageQueue::thread_singleton = …; void MessageQueue::set_thread_singleton_override(CallQueue *p_thread_singleton) { … } MessageQueue::MessageQueue() : … { … } MessageQueue::~MessageQueue() { … }