Add wait semaphore to thread body.