Remove the sem_init implementation

pthread_mutex works on Linux anyway and isn't obviously any better at
coping with fork() issues.
Test case for the locking stuff.

Probably not particularly great at finding issues on all platforms.
Notably Windows doesn't seem to crash without it anyway.