Skip to content

Commit

Permalink
Revert "don't block unless shutdown is allowed"
Browse files Browse the repository at this point in the history
This reverts commit 31dfe32.
  • Loading branch information
dipinhora committed Dec 4, 2024
1 parent fb84697 commit 55d0895
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/libponyrt/sched/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ static PONY_ATOMIC(uint32_t) active_scheduler_count_check;
static scheduler_t* scheduler;
static PONY_ATOMIC(bool) temporarily_disable_scheduler_scaling;
static PONY_ATOMIC(bool) detect_quiescence;
static PONY_ATOMIC(bool) shutdown_allowed;
static bool use_yield;
static mpmcq_t inject;
static __pony_thread_local scheduler_t* this_scheduler;
Expand Down Expand Up @@ -888,10 +887,7 @@ static pony_actor_t* steal(scheduler_t* sched)
steal_attempts++;
}
else if ((clocks_elapsed > PONY_SCHED_BLOCK_THRESHOLD) &&
(ponyint_mutemap_size(&sched->mute_mapping) == 0) &&
// only if shutdown is allowed because there's a race between startup
// and termination signalling to wake sleeping threads otherwise
atomic_load_explicit(&shutdown_allowed, memory_order_relaxed))
(ponyint_mutemap_size(&sched->mute_mapping) == 0))
{
// only considered blocked if we're scheduler > 0 or if we're scheduler
// 0 and there are no noiisy actors registered
Expand Down Expand Up @@ -1330,9 +1326,6 @@ bool ponyint_sched_start(bool library)

atomic_store_explicit(&detect_quiescence, !library, memory_order_relaxed);

// disable shutdown until all threads are started and running
atomic_store_explicit(&shutdown_allowed, true, memory_order_relaxed);

DTRACE0(RT_START);
uint32_t start = 0;

Expand All @@ -1348,9 +1341,6 @@ bool ponyint_sched_start(bool library)
return false;
}

// enable shutdown now that all threads are started and running
atomic_store_explicit(&shutdown_allowed, true, memory_order_relaxed);

#if defined(USE_SYSTEMATIC_TESTING)
// start processing
SYSTEMATIC_TESTING_START(scheduler, ponyint_asio_get_backend_tid(), ponyint_asio_get_backend_sleep_object());
Expand Down

0 comments on commit 55d0895

Please sign in to comment.