MCPcopy Create free account
hub / github.com/borndotcom/react-native-godot / enqueue

Method enqueue

android/src/main/cpp/GodotModule.cpp:115–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113 }
114
115 void enqueue(std::function<void()> f) {
116 if (thread.get_id() == std::this_thread::get_id()) {
117 f();
118 return;
119 }
120 {
121 std::lock_guard<std::mutex> lock(mutex);
122 tasks.emplace(f);
123 }
124 ssize_t res = write(function_queue_fd, &CMD_FUNCTION, sizeof(CMD_FUNCTION));
125 if (res < 0) {
126 LOGE("Unable to write to pipe: %d", errno);
127 }
128 if (res != sizeof(CMD_FUNCTION)) {
129 LOGE("Unable to write command fully to pipe");
130 }
131 }
132
133 void run() {
134 LOGI("AndroidThread Looper thread started.");

Callers 6

focus_outMethod · 0.80
focus_inMethod · 0.80
appPauseMethod · 0.80
appResumeMethod · 0.80
updateStateMethod · 0.80
runOnGodotThreadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected