Related to this question --- I'm debugging some code that unlocks a mutex twice and I'm trying to figure out exactly when it happens. I'm getting stack traces out of Helgrind, but I'd like the program to crash immediately when it performs the bad unlock.
I know the behavior of unlocking an already-unlocked mutex is undefined, and so nasal demons are an acceptable implementation --- I certainly can't force nasal demons to crash. But given the pthreads implementation in recent versions of glibc, is there a way to get this behavior reasonably reliably?