Skip to content

Commit

Permalink
Merge pull request #372 from vibe-d/taskpool_workaround
Browse files Browse the repository at this point in the history
Work around unfair event object behavior in eventcore
  • Loading branch information
l-kramer authored Dec 15, 2023
2 parents 5864353 + 0b92e6f commit 28410a1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/vibe/core/taskpool.d
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ shared final class TaskPool {
"Cannot convert arguments '"~ARGS.stringof~"' to function arguments '"~FARGS.stringof~"'.");

m_state.lock.queue.put(settings, callable, args);
m_signal.emitSingle();
// NOTE: we need to notify all threads here in order to guarantee proper distribution of
// tasks, as currently the eventcore event implementation does not result in a fair
// scheduling
m_signal.emit();
}

private void runTaskDist_unsafe(CALLABLE, ARGS...)(TaskSettings settings, ref CALLABLE callable, ARGS args) // NOTE: no ref for args, to disallow non-copyable types!
Expand Down

0 comments on commit 28410a1

Please sign in to comment.