Introduction - If you have any usage issues, please Google them yourself
Textbooks on algorithms is a semaphore mechanism to achieve (do not ask me what is semaphores, textbook did not speak). Declare a int variable mutex (semaphore), call wait () signal () method. wait (mutex)// if (mutex == 0) (blocking the current process) else (mutex-) signal (mutex)// mutex++ wake-up wait process