Update SafeSemaphore.

Closes #119.

Signed-off-by: Magnus Therning <magnus@therning.org>