Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::shared...lock_shared(3)  C++ Standard Libary std::shared...lock_shared(3)

NAME
       std::shared_mutex::lock_shared -	std::shared_mutex::lock_shared

Synopsis
	  void lock_shared();  (since C++17)

	  Acquires shared ownership of the mutex. If another thread is holding
       the mutex in
	  exclusive  ownership,	a call to lock_shared will block execution un-
       til shared
	  ownership can	be acquired.

	  If lock_shared is called by a	thread that already owns the mutex  in
       any mode
	  (exclusive or	shared), the behavior is undefined.

	  If  more  than  the  implementation-defined maximum number of	shared
       owners already
	  locked the mutex in shared mode, lock_shared blocks execution	 until
       the number of
	  shared owners	is reduced. The	maximum	number of owners is guaranteed
       to be at	least
	  10000.

	  A  prior  unlock() operation on the same mutex synchronizes-with (as
       defined in
	  std::memory_order) this operation.

Parameters
	  (none)

Return value
	  (none)

Exceptions
	  Throws std::system_error when	errors occur,  including  errors  from
       the underlying
	  operating system that	would prevent lock from	meeting	its specifica-
       tions. The mutex
	  is not locked	in the case of any exception being thrown.

Notes
	  lock_shared()	 is  usually  not called directly: std::shared_lock is
       used to manage
	  shared locking.

Example
	   This	section	is incomplete
	   Reason: no example

See also
	  lock		  locks	the mutex, blocks if the mutex is  not	avail-
       able
			  (public member function)
			  tries	 to  lock  the mutex for shared	ownership, re-
       turns if	the mutex
	  try_lock_shared is not available
			  (public member function)
	  unlock_shared	  unlocks the mutex (shared ownership)
			  (public member function)

http://cppreference.com		  2022.07.31	  std::shared...lock_shared(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::shared_mutex::lock_shared&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help