initial untested semaphore implementation usinglocks