The author posted a question in Programming
How do mutexes work? How do mutexes work? and got a better answer
Response from
Response from 0[+]
Very simple. I will describe in detail. Roughly speaking mutex is a public toilet, it can get only one person at a time. In our case, a person is a thread that executes instructions, and a code block plays the role of a toilet. a mutex can, like a toilet, open and close, and threads, like people, can line up. When a mutex is open, your thread goes in and closes it, then does its nasty business and comes out, and then other threads. Like the person from the toilet.
Very simple. I will describe in detail. Roughly speaking mutex is a public toilet, it can get only one person at a time. In our case, a person is a thread that executes instructions, and a code block plays the role of a toilet. a mutex can, like a toilet, open and close, and threads, like people, can line up. When a mutex is open, your thread goes in and closes it, then does its nasty business and comes out, and then other threads. Like the person from the toilet.
Response from 0[++]
Man, I don't want to get a bald haircut when I have to go to the army either, I've been growing them for two fucking years, bitches, we don't need a haircut
Man, I don't want to get a bald haircut when I have to go to the army either, I've been growing them for two fucking years, bitches, we don't need a haircut