If you trust this link, click it to continue.
https://stackoverflow.com/questions/79012177/how-use-semaphore-instead-this-code-wait-with-active-loop-linux-kernel