by lrossi · 5y ago · 0 comments
The ability to pause a thread from outside is interesting, but it doesn’t seem very useful in general.
It also comes with risks. What if it’s holding a lock? That could cause a performance/latency disaster.
There are coroutines though, that can fill some of the same needs covered by lightweight threads: https://en.cppreference.com/w/cpp/language/coroutines
>>> The ability to pause a thread from outside is interesting, but it doesn’t seem very useful in general.
>>> It also comes with risks. What if it’s holding a lock? That could cause a performance/latency disaster.
Which you replied to, not claiming that it couldn't be paused from outside, but instead that the lock risk was just the same as returning from a function.