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

Function ThreadMain

test/core/pthread/exceptions.cpp:22–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20static std::atomic<int> total;
21
22void *ThreadMain(void *arg) {
23 for (int i = 0; i < TOTAL; i++) {
24 try {
25 // Throw two different types, to make sure we check throwing and landing
26 // pad behavior.
27 if (i & 3) {
28 throw 3.14159f;
29 }
30 throw i;
31 } catch (int x) {
32 total += x;
33 } catch (float f) {
34 // wait for a change, so we see interleaved processing.
35 int last = ++sum;
36 while (sum.load() == last) {}
37 }
38 }
39 pthread_exit((void*)TOTAL);
40}
41
42pthread_t thread[NUM_THREADS];
43

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected