semaphore: thread test now uses semaphore