Skip to content

Commit

Permalink
don't signal invalid threads
Browse files Browse the repository at this point in the history
  • Loading branch information
dipinhora committed Dec 4, 2024
1 parent 718fe9f commit 8cea50f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libponyrt/sched/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,19 @@ static void signal_suspended_threads(uint32_t sched_count, int32_t curr_sched_id
for(uint32_t i = start_sched_index; i < sched_count; i++)
{
if((int32_t)i != curr_sched_id)
{
#if defined(USE_SYSTEMATIC_TESTING)
SYSTEMATIC_TESTING_YIELD();
#else
ponyint_thread_wake(scheduler[i].tid, scheduler[i].sleep_object);
// only send signal if the thread id is not NULL (musl specifically
// crashes if it is even though posix says it should return `ESRCH`
// instead if an invalid thread id is passed)
// this is only a concern during startup until the thread is created
// and pthread_create updates the thread id
if(scheduler[i].tid)
ponyint_thread_wake(scheduler[i].tid, scheduler[i].sleep_object);
#endif
}
}
}

Expand Down

0 comments on commit 8cea50f

Please sign in to comment.