Add some helper methods.
Add the initialization of semaphores.
But the semaphores are not yet added to the header file.