Skip to content

Commit 30cea1a

Browse files
authored
[Wasm64] futex fixes (#20116)
1 parent 89011ee commit 30cea1a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

system/lib/pthread/emscripten_futex_wait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int futex_wait_main_browser_thread(volatile void* addr,
100100
// here and return, it's the same is if what happened on the main thread
101101
// was the same as calling _emscripten_yield()
102102
// a few times before calling emscripten_futex_wait().
103-
if (__c11_atomic_load((_Atomic uintptr_t*)addr, __ATOMIC_SEQ_CST) != val) {
103+
if (__c11_atomic_load((_Atomic uint32_t*)addr, __ATOMIC_SEQ_CST) != val) {
104104
return -EWOULDBLOCK;
105105
}
106106

test/pthread/test_pthread_atomics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void RunTest(int test)
129129

130130
for(int i = 0; i < NUM_THREADS; ++i)
131131
{
132-
int status = 1;
132+
intptr_t status = 1;
133133
int rc = pthread_join(thread[i], (void**)&status);
134134
assert(rc == 0);
135135
assert(status == 0);

test/pthread/test_pthread_sbrk.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ static void *thread_start(void *arg)
4040
pthread_mutex_unlock( &mutex );
4141
#endif
4242

43-
int id = (int)(intptr_t)(arg)+1;
44-
int return_code = RESULT_OK;
43+
intptr_t id = (intptr_t)(arg)+1;
44+
intptr_t return_code = RESULT_OK;
4545

4646
uint8_t *allocated_buffers[NUM_ALLOCATIONS] = {};
4747

@@ -73,7 +73,7 @@ static void *thread_start(void *arg)
7373
{
7474
++return_code; // Failed! (but run to completion so that the barriers will all properly proceed without hanging)
7575
if (!reported_once) {
76-
emscripten_errf("Memory corrupted! mem[i]: %d != %d, i: %d, j: %d", allocated_buffers[i][j], id, i, j);
76+
emscripten_errf("Memory corrupted! mem[i]: %d != %ld, i: %d, j: %d", allocated_buffers[i][j], id, i, j);
7777
reported_once = 1; // Avoid print flood that makes debugging hard.
7878
}
7979
}
@@ -111,7 +111,7 @@ int main()
111111
assert(ret == 0);
112112

113113
pthread_t thr[8/*NUM_THREADS*/];
114-
for(int i = 0; i < NUM_THREADS; ++i)
114+
for(intptr_t i = 0; i < NUM_THREADS; ++i)
115115
{
116116
pthread_attr_t attr;
117117
pthread_attr_init(&attr);

0 commit comments

Comments
 (0)