首页 > 代码库 > 并发,互斥,锁。草稿

并发,互斥,锁。草稿

Mutex class

A mutex is a lockable object that is designed to signal when critical sections of code need exclusive access, preventing other threads with the same protection from executing concurrently and access the same memory locations.

mutex objects provide exclusive ownership and do not support recursivity (i.e., a thread shall not lock a mutex it already owns) -- see recursive_mutex for an alternative class that does.

It is guaranteed to be a standard-layout class.

Member types

member typedescription
native_handle_type Type returned by native_handle (only defined if library implementation supports it)

 

Member functions

(constructor)
Construct mutex (public member function )
lock
Lock mutex (public member function )
try_lock
Lock mutex if not locked (public member function )
unlock
Unlock mutex (public member function )
native_handle
Get native handle (public member function )

并发,互斥,锁。草稿