macOS issues
-mmacosx-version-min
is required at link time as well, otherwise it may link different libraries. Hopefully this is the issue. That would also explain why it works for SciPy - I was already passing the link argument.
Merge request reports
Activity
added 1 commit
- dce19dea - Hold lock in latch::count_down to avoid cv destruction before notify
I think I've got it now, found an almost identical issue on GitHub: https://github.com/lewissbaker/cppcoro/issues/98
I have to say, the issue is really devious. It's generally okay to call notify on a condition variable without locking the mutex but here it can lead to issues. If the cv wakes up spuriously before the worker thread calls notify but after it has set
num_left_=0
, the condition variable can be destroyed before the worker calls notify on it. I guess macOS is more prone to spurious wakes than linux?Also, I think the reason why it always segfaulted under python is because it was accessing invalid stack locations and python compiles with
-fstack-protector-strong
enabled.Edited by Peter Bellmentioned in commit c0f74f61