created base class Semaphore with with_lock and with_try_lock and unit tests for it