Skip to content

Commit 4efaa6c

Browse files
authored
[test] Rename some browser test files to match test name. NFC (#26784)
Also, convert a few more `.cpp` tests to `.c`.
1 parent 43f30b5 commit 4efaa6c

16 files changed

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include <assert.h>
22
#include <emscripten/em_asm.h>
33
#include <stdio.h>
4-
#include <thread>
4+
#include <pthread.h>
55
#include <math.h>
66

7-
std::atomic<int> ret;
7+
_Atomic int ret;
88

9-
void foo() {
9+
void* foo(void* arg) {
1010
int len = MAIN_THREAD_EM_ASM_INT({
1111
var elem = document.getElementById('elem');
1212
window.almost_PI = 3.14159;
@@ -19,11 +19,14 @@ void foo() {
1919
printf("almost PI: %f\n", almost_PI);
2020
assert(fabs(almost_PI - 3.14159) < 0.001);
2121
ret = len;
22+
return NULL;
2223
}
2324

2425
int main() {
25-
std::thread t(foo);
26-
t.join();
27-
printf("ret: %d\n", ret.load());
28-
return ret.load();
26+
pthread_t t;
27+
pthread_create(&t, NULL, foo, NULL);
28+
pthread_join(t, NULL);
29+
printf("ret: %d\n", ret);
30+
assert(ret == 8);
31+
return 0;
2932
}
File renamed without changes.

0 commit comments

Comments
 (0)