ThreadProc, Semaphores