Skip to content

coro::thread_pool_ws (work stealing)#450

Draft
jbaldwin wants to merge 2 commits intomainfrom
issue-404/thread-pool-ws
Draft

coro::thread_pool_ws (work stealing)#450
jbaldwin wants to merge 2 commits intomainfrom
issue-404/thread-pool-ws

Conversation

@jbaldwin
Copy link
Owner

@jbaldwin jbaldwin commented Mar 5, 2026

This is a proof of concept that would replace the normal coro::thread_pool if it works out, this uses a chase lev work stealing queue with an atomic list for the global queue when schedules happen outside a thread pool worker. It leverages thread_local uint32_t to lookup the current threads index for its owned internally local thread queue, if that isn't set then we know we're off a worker thread and need to enqueue on the global queue.

@jbaldwin jbaldwin self-assigned this Mar 5, 2026
@jbaldwin jbaldwin force-pushed the issue-404/thread-pool-ws branch 2 times, most recently from 1438295 to acd9955 Compare March 5, 2026 18:47
@PyXiion
Copy link
Contributor

PyXiion commented Mar 5, 2026

Using CPM for dependencies is good, I wanted to suggest it sooner or later

Consider to migrate other dependencies too

This is a proof of concept that would replace the normal
coro::thread_pool if it works out, this uses a chase lev work stealing
queue with an atomic list for the global queue when schedules happen
outside a thread pool worker. It leverages thread_local uint32_t to
lookup the current threads index for its owned internally local thread
queue, if that isn't set then we know we're off a worker thread and need
to enqueue on the global queue.
@jbaldwin jbaldwin force-pushed the issue-404/thread-pool-ws branch from acd9955 to 1d9605d Compare March 5, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants