Added semaphore test

This should solve issue #362