|
|
|
|
|
by brandmeyer
2358 days ago
|
|
> Not sure but there may be two bugs in the code. The use of notify on the condition outside of the mutex lock. That's not a bug. The notifier can either signal the condition variable with or without the corresponding lock held and both cases are race-free. In some implementations, it may be more performant to signal the condvar with the lock still held, while in others it is more performant to signal the condvar after releasing the lock. In this discussion "implementations" isn't referring to boost, libstdc++, or LLVM's glue library, "implementations" is referring to the underlying system libraries. Alas, most of the implementations aren't willing to tell you which one is better. |
|
What would the case where it's more performant to notify while holding the lock look like? Is the underlying implementation somehow able to transfer ownership of the mutex?