Skip to content

Commit 75c10e4

Browse files
authored
fix bug in thread self-wakeup (#32382)
1 parent 58bafe4 commit 75c10e4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/partr.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,12 @@ static int sleep_check_after_threshold(uint64_t *start_cycles)
343343
/* ensure thread tid is awake if necessary */
344344
JL_DLLEXPORT void jl_wakeup_thread(int16_t tid)
345345
{
346-
int16_t self = jl_get_ptls_states()->tid;
346+
jl_ptls_t ptls = jl_get_ptls_states();
347+
int16_t self = ptls->tid;
347348
int16_t uvlock = jl_atomic_load_acquire(&jl_uv_mutex.owner);
348349
if (tid == self) {
349350
// we're already awake, but make sure we'll exit uv_run
351+
jl_atomic_store(&ptls->sleep_check_state, not_sleeping);
350352
if (uvlock == self)
351353
uv_stop(jl_global_event_loop());
352354
}

0 commit comments

Comments
 (0)