jbaldwin / libcoro

C++20 coroutine library
Apache License 2.0
566 stars 57 forks source link

Use std::thread for coro::thread_pool #221

Closed jbaldwin closed 9 months ago

jbaldwin commented 9 months ago

Closes #220

jbaldwin commented 9 months ago

@bruno-j-nicoletti I think I found it! Its the notify_all() in the shutdown, its got some kind of a race condition and by placing the lock around it before calling it guarantees each worker thread in the coro::thread_pool will properly catch it. Clearly the std::jthread stop_token handled this properly :grimacing: . Please take a look, I did find one relaxed instance that was probably wrong so that got fixed as well.