Skip to content

Commit 8a9d113

Browse files
committed
Revert incorrect pthread optimization
It didn't work in some circumstances.
1 parent 98665b1 commit 8a9d113

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

system/lib/pthread/library_pthread.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,16 @@ EMSCRIPTEN_RESULT emscripten_wait_for_call_v(em_queued_call* call, double timeou
394394
emscripten_set_current_thread_status(EM_THREAD_STATUS_WAITPROXY);
395395

396396
double timeoutUntilTime = emscripten_get_now() + timeoutMSecs;
397-
int r;
398397
do {
399-
r = emscripten_futex_wait(&call->operationDone, 0, timeoutMSecs);
398+
emscripten_futex_wait(&call->operationDone, 0, timeoutMSecs);
399+
done = emscripten_atomic_load_u32(&call->operationDone);
400400

401401
timeoutMSecs = timeoutUntilTime - emscripten_get_now();
402-
} while (r == -ETIMEDOUT && timeoutMSecs > 0);
402+
} while (!done && timeoutMSecs > 0);
403403

404404
emscripten_set_current_thread_status(EM_THREAD_STATUS_RUNNING);
405405

406-
return r == 0 ? EMSCRIPTEN_RESULT_SUCCESS : EMSCRIPTEN_RESULT_TIMED_OUT;
406+
return done ? EMSCRIPTEN_RESULT_SUCCESS : EMSCRIPTEN_RESULT_TIMED_OUT;
407407
}
408408

409409
EMSCRIPTEN_RESULT emscripten_wait_for_call_i(

0 commit comments

Comments
 (0)