MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / thread_main

Function thread_main

test/pthread/test_pthread_reltime.cpp:25–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23static bool pong_requested = false;
24
25void *thread_main(void *arg) {
26 std::cout << "running thread ..." << std::endl;
27
28 std::unique_lock<std::mutex> lock(mutex);
29 while (!pong_requested)
30 cond_var.wait(lock);
31 pong = now(); // Measure time in the pthread
32 std::cout << "pong - ping: " << (pong - ping) << std::endl;
33 pong_requested = false;
34 cond_var.notify_one();
35
36 return NULL;
37}
38
39EMSCRIPTEN_KEEPALIVE
40extern "C" int notify() {

Callers

nothing calls this directly

Calls 3

nowFunction · 0.85
waitMethod · 0.45
notify_oneMethod · 0.45

Tested by

no test coverage detected