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

Function main

test/pthread/test_pthread_64bit_atomics.c:126–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126int main() {
127 globalDouble = 5.0;
128 globalU64 = 4;
129
130 uint64_t prevU64 = emscripten_atomic_add_u64((void*)&globalU64, 1);
131 assert(prevU64 == 4);
132
133 for (int i = 0; i < 7; ++i) {
134 RunTest(i);
135 }
136
137 uint64_t totalRead = 0;
138 uint64_t totalWritten = 0;
139 for (int i = 0; i < NUM_THREADS; ++i) {
140 totalRead += threadCasAccumulatedReadData[i];
141 totalWritten += threadCasAccumulatedWrittenData[i];
142 }
143 for (int i = 0; i < DATA_COUNT; ++i) {
144 totalRead += sharedData[i];
145 }
146
147 if (totalRead == totalWritten) {
148 emscripten_outf("totalRead: %llu, totalWritten: %llu\n", totalRead, totalWritten);
149 } else {
150 emscripten_outf("64-bit CAS test failed! totalRead != totalWritten (%llu != %llu)\n", totalRead, totalWritten);
151 }
152 assert(totalRead == totalWritten);
153 emscripten_outf("Main: Test successfully finished");
154 return 0;
155}

Callers

nothing calls this directly

Calls 4

RunTestFunction · 0.70
emscripten_outfFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected