Namespaces
Variants
Views
Actions

std::shared_lock

From cppreference.com
< cpp‎ | thread
Revision as of 13:04, 18 May 2013 by P12 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 
 
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(C++11)
shared_lock
(C++14)
(C++11)
(C++11)
(C++11)
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
(C++11)
Safe Reclamation
(C++26)
Hazard Pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11)(deprecated in C++20)
(C++11)(deprecated in C++20)
Memory ordering
Free functions for atomic operations
Free functions for atomic flags
 
 
Defined in header <mutex>
template< class Mutex >
class shared_lock;
(since C++11)

The class shared_lock is a general-purpose shared mutex ownership wrapper allowing deferred locking, timed locking and transfer of lock ownership,

The shared_lock class is movable, but not copyable -- it meets the requirements of Template:concept and Template:concept but not of Template:concept or Template:concept.

Contents

Template parameters

Mutex - the type of the shared mutex to lock. The type must meet the Template:concept requirements

Member types

Type Definition
mutex_type Mutex

Member functions

Template:cpp/thread/shared lock/dcl list constructorTemplate:cpp/thread/shared lock/dcl list destructorTemplate:cpp/thread/shared lock/dcl list operator=Template:cpp/thread/shared lock/dcl list lockTemplate:cpp/thread/shared lock/dcl list try lockTemplate:cpp/thread/shared lock/dcl list try lock forTemplate:cpp/thread/shared lock/dcl list try lock untilTemplate:cpp/thread/shared lock/dcl list unlockTemplate:cpp/thread/shared lock/dcl list swapTemplate:cpp/thread/shared lock/dcl list releaseTemplate:cpp/thread/shared lock/dcl list mutexTemplate:cpp/thread/shared lock/dcl list owns lockTemplate:cpp/thread/shared lock/dcl list operator bool
Shared locking
Modifiers
Observers

Non-member functions

Template:cpp/thread/shared lock/dcl list swap2