What C++ synchronization primitives can I use when using Linux’s clone(2) threads? I specifically cannot use pthreads because I’m building a shared library that replaces many of pthreads’s function calls with different definitions, but I’m in need of a mutex of some sort.
EDIT: I might have spoke too soon, I looked at the pthread docs and they use a futex(2) to implement these primitives. I’m assuming that is how I would do this, too?
You can use
futexhttp://en.wikipedia.org/wiki/FutexHere are simple mutex and cond var based on futex http://locklessinc.com/articles/mutex_cv_futex/