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

FreeBSD Manual Pages

  
 
  

home | help
std::condit...variable_any(3) C++ Standard Libarystd::condit...variable_any(3)

NAME
       std::condition_variable_any - std::condition_variable_any

Synopsis
	  Defined in header <condition_variable>
	  class	condition_variable_any;		  (since C++11)

	  The  condition_variable_any class is a generalization	of std::condi-
       tion_variable.
	  Whereas      std::condition_variable	     works	 only	    on
       std::unique_lock<std::mutex>,
	  condition_variable_any  can operate on any lock that meets the Basi-
       cLockable
	  requirements.

	  See std::condition_variable for the description of the semantics  of
       condition
	  variables.

	  The class std::condition_variable_any	is a StandardLayoutType. It is
       not
	  CopyConstructible, MoveConstructible,	CopyAssignable,	or MoveAssign-
       able.

	  If the lock is std::unique_lock<std::mutex>, std::condition_variable
       may provide
	  better performance.

Member functions
	  constructor	constructs the object
			(public	member function)
	  destructor	destructs the object
			(public	member function)
	  operator=	not copy-assignable
	  [deleted]	(public	member function)

Notification
	  notify_one	notifies one waiting thread
			(public	member function)
	  notify_all	notifies all waiting threads
			(public	member function)

Waiting
	  wait		blocks the current thread until	the condition variable
       is woken	up
			(public	member function)
			blocks the current thread until	the condition variable
       is woken	up or
	  wait_for	after the specified timeout duration
			(public	member function)
			blocks the current thread until	the condition variable
       is woken	up or
	  wait_until	until specified	time point has been reached
			(public	member function)

Notes
	  std::condition_variable_any can be used with std::shared_lock	in or-
       der to wait on a
	  std::shared_mutex in shared ownership	mode.

	  A  possible use for std::condition_variable_any with custom Lockable
       types is	to
	  provide convenient interruptible waits: the  custom  lock  operation
       would both lock
	  the  associated  mutex  as  expected,	and also perform the necessary
       setup to	notify
	  this	condition  variable  when  the	interrupting  signal  is   re-
       ceived.^[1]

See also
	  condition_variable  provides	a condition variable associated	with a
       std::unique_lock
	  (C++11)	     (class)

External links
	   1.  Anthony Williams	(2012, 1st ed./	2019, 2nd  ed.),  C++  Concur-
       rency in
	      Action,	9.2.4  Interrupting  a	wait  on  std::condition_vari-
       able_any.

http://cppreference.com		  2022.07.31	 std::condit...variable_any(3)

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

home | help