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

Method run

android/src/main/cpp/GodotModule.cpp:133–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131 }
132
133 void run() {
134 LOGI("AndroidThread Looper thread started.");
135 LibGodot::get_jni_env(); // Force attaching to Java VM
136 {
137 std::lock_guard<std::mutex> lock(mutex);
138
139 // Prepare Looper
140 looper = ALooper_prepare(0);
141
142 // Register callback for function
143 int fds[2];
144 int res = pipe(fds);
145 if (res < 0) {
146 LOGE("Unable to create pipe for ALooper: %d", errno);
147 return; // TODO: Abort app
148 }
149 ALooper_addFd(looper, fds[0], ALOOPER_POLL_CALLBACK, ALOOPER_EVENT_INPUT, AndroidThread::looper_callback, this);
150 function_queue_fd = fds[1];
151 started.notify_all();
152 }
153
154 while (!quit) {
155 int outFd;
156 int outEvents;
157 void *outData;
158 int res = ALooper_pollOnce(10, &outFd, &outEvents, &outData);
159 if (res == ALOOPER_POLL_ERROR) {
160 LOGE("ALooper_pollOnce internal error.");
161 }
162 }
163
164 ALooper_release(looper);
165 LOGI("AndroidThread Looper thread exited.");
166 }
167};
168
169typedef struct FuncData {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected