Implementation of semaphores for ECE357