Added semaphore from previous assignment.
Finished implementation for assignment 4.