Skip to content

Commit

Permalink
fix bug in thread self-wakeup (#32382)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Jun 21, 2019
1 parent 58bafe4 commit 75c10e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/partr.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,12 @@ static int sleep_check_after_threshold(uint64_t *start_cycles)
/* ensure thread tid is awake if necessary */
JL_DLLEXPORT void jl_wakeup_thread(int16_t tid)
{
int16_t self = jl_get_ptls_states()->tid;
jl_ptls_t ptls = jl_get_ptls_states();
int16_t self = ptls->tid;
int16_t uvlock = jl_atomic_load_acquire(&jl_uv_mutex.owner);
if (tid == self) {
// we're already awake, but make sure we'll exit uv_run
jl_atomic_store(&ptls->sleep_check_state, not_sleeping);
if (uvlock == self)
uv_stop(jl_global_event_loop());
}
Expand Down

0 comments on commit 75c10e4

Please sign in to comment.