Implementation of nn_sem for OSX

OSX semaphores are broken. This patch simulates the semaphore
by using condition variable.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>