Examples synchronization with semaphores c++