C++ Language/Std/Multithreading/Semaphores/FragmentOrdering
A semaphore can be used to order the execution of code fragments in different threads. In this case, the "resource" isn't a physical thing, it's permission to execute the subsequent code fragment.
Additional information about using a semaphore for fragment ordering