thread: add generic futex-based muteces