Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::mutex | singheart's blog #9

Open
xinjiempolde opened this issue Jun 3, 2022 · 0 comments
Open

std::mutex | singheart's blog #9

xinjiempolde opened this issue Jun 3, 2022 · 0 comments

Comments

@xinjiempolde
Copy link
Owner

http://singhe.art/2022/05/31/std-mutex/#more

本文转载自CSDN std::mutex互斥量是一个可以处于两态之一的变量:解锁和加锁。这样,只需要一个二进制位表示它,不过实际上,常常使用一个整型量,0表示解锁,而其他所有的值则表示加锁。互斥量使用两个过程。当一个线程(或进程)需要访问临界区时,它调用mutex_lock。如果该互斥量当前是解锁的(即临界区可用),此调用成功,调用线程可以自由进入该临界区。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant