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 type | description |
---|---|
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 )
时间: 2024-10-14 20:54:01