semaphore  and reentrantlock