Home > Back-end >  What is the lock?
What is the lock?

Time:09-24

What is the lock?
To see some articles, often used as a multithreaded, speaking, reading and writing lock
So what is the lock?
Are there any standard c + +? (c + + library definition)
What is the mechanism of lock (what is the principle)?
PS: can you send some articles let me consider

CodePudding user response:

1. C + + standard library, a lock is located in the header file mutex,
2. For example, you go to the toilet suddenly rushed in and afraid of others? Most people are afraid of, so the public toilet generally have a lock, computer lock of also is such, is because of the lock, and makes some operating part can monopolize the resources

CodePudding user response:

Can be read

CodePudding user response:

Can read 1
Can be read 2

CodePudding user response:

reference 1st floor Italink response:
1. C + + standard library, a lock is located in the header file mutex,
2. For example, you go to the toilet suddenly rushed in and afraid of others? Most people are afraid of, so the public toilet generally have a lock, lock, too, from a computer with lock, and makes some operating part can monopolize resources

Thank you, but you have what good article?

CodePudding user response:

Is for the exclusive lock, it system resources are Shared, but some resources sharing conflict happens, locking resources, then locked resources can only by the owner of the lock to enjoy alone, other users have to wait for the lock release,
Lock mutex header file defines some standard
Type and principle of the lock can refer to
https://zhuanlan.zhihu.com/p/53910908
https://www.zhihu.com/question/66733477

CodePudding user response:


Mainly used for multithreading, multi-process, access to modify the public resources, avoid mistakes,

CodePudding user response:

reference 5 floor qybao reply:
lock is for the exclusive and original system resources are Shared, but some resources sharing conflict happens, locking resources, then locked resources can only by the owner of the lock to enjoy alone, other users have to wait for the lock release,
Lock mutex header file defines some standard
Type and principle of the lock can refer to
https://zhuanlan.zhihu.com/p/53910908
https://www.zhihu.com/question/66733477

Thanks for a great god

CodePudding user response:

reference 5 floor qybao reply:
lock is for the exclusive and original system resources are Shared, but some resources sharing conflict happens, locking resources, then locked resources can only by the owner of the lock to enjoy alone, other users have to wait for the lock release,
Lock mutex header file defines some standard
Type and principle of the lock can refer to
https://zhuanlan.zhihu.com/p/53910908
https://www.zhihu.com/question/66733477

Thank you very much! But the c + + 11?
  • Related