Skip to content

Commit 073544f

Browse files
committed
chore(pool): revert adaptive spin wait
1 parent 1d6dd0d commit 073544f

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

core/pool.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,8 @@ raw_p executor_run(raw_p arg) {
180180
__atomic_store_n(&executor->vm, vm, __ATOMIC_RELAXED);
181181

182182
for (;;) {
183-
// Adaptive spin-wait: spin briefly before sleeping (reduces wake latency)
184-
i64_t spin_rounds = 0;
185-
while (spin_rounds < 1000) {
186-
if (__atomic_load_n(&executor->pool->tasks_count, __ATOMIC_ACQUIRE) > 0)
187-
break;
188-
if (__atomic_load_n(&executor->pool->state, __ATOMIC_ACQUIRE) == RUN_STATE_STOPPED)
189-
break;
190-
backoff_spin(&spin_rounds);
191-
}
192-
193183
mutex_lock(&executor->pool->mutex);
194-
// Re-check after acquiring lock
195-
if (executor->pool->tasks_count == 0 && executor->pool->state == RUN_STATE_RUNNING)
196-
cond_wait(&executor->pool->run, &executor->pool->mutex);
184+
cond_wait(&executor->pool->run, &executor->pool->mutex);
197185

198186
if (executor->pool->state == RUN_STATE_STOPPED) {
199187
mutex_unlock(&executor->pool->mutex);

0 commit comments

Comments
 (0)