Semaphores are not available in C++ as of now, but can easily be implemented with a mutex and a condition variable.
This example was taken from:
C++0x has no semaphores? How to synchronize threads?