Closed faern closed 2 years ago
I believe yield_now
should be correct but clarification would be helpful.
If so, maybe an alias can be created? It's much easier to conditionally import loom::thread
vs std::thread
vs having to having more fine grained conditional import over specific functions.
I have a library that uses
std::thread::park()
andThread::unpark()
for parking one thread when it must wait for another thread to reach a certain point. These tests deadlock underloom
. I assume simply because the execution order it's currently evaluating demand that the thread waiting inpark()
make progress, and not the other ones. And this will obviously never happen.I have currently gotten the tests to pass by conditionally replacing
std::thread::park()
withloom::thread::yield_now()
. However, I'm not fully sure this tests what I want it to test 🤔Since I don't know anything about
loom
internals etc I will put it like this: Would it make sense to exposeloom::thread::park
and potentially a correspondingloom::thread::Thread
?