Implement recursive mutexes... this assumes that all 0xff is an invalid
(or at least unusable) pthread_t which is fine on FreeBSD as it's a pointer. I've left the recursive stuff in with an #ifdef __linux__ wrapper though it's a Bad Thing. After I talk to DigitalMan, this may all get ripped out in favour of proper pthread mutex usage, but I'm not sure why he wants recursive mutexes.
Showing with 61 additions and 20 deletions