ConditionVarDirect
from panda3d.core import ConditionVarDirect
- class ConditionVarDirect
Bases:
DTOOL_SUPER_BASE
A condition variable, usually used to communicate information about changing state to a thread that is waiting for something to happen. A condition variable can be used to “wake up” a thread when some arbitrary condition has changed.
A condition variable is associated with a single mutex, and several condition variables may share the same mutex.
Inheritance diagram
- __init__(*args, **kwargs)
- getMutex()
C++ Interface: get_mutex(ConditionVarDirect self)
- /**
Returns the mutex associated with this condition variable.
*/
- get_mutex()
C++ Interface: get_mutex(ConditionVarDirect self)
- /**
Returns the mutex associated with this condition variable.
*/
- notify()
C++ Interface: notify(const ConditionVarDirect self)
- /**
Informs one of the other threads who are currently blocked on wait() that
the relevant condition has changed. If multiple threads are currently
waiting, at least one of them will be woken up, although there is no way to
predict which one. It is possible that more than one thread will be woken
up.
If no threads are waiting, this is a no-op: the notify event is lost.
*/
- notifyAll()
C++ Interface: notify_all(const ConditionVarDirect self)
- /**
Informs all of the other threads who are currently blocked on wait() that
the relevant condition has changed.
If no threads are waiting, this is a no-op: the notify event is lost.
*/
- notify_all()
C++ Interface: notify_all(const ConditionVarDirect self)
- /**
Informs all of the other threads who are currently blocked on wait() that
the relevant condition has changed.
If no threads are waiting, this is a no-op: the notify event is lost.
*/
- output()
C++ Interface: output(ConditionVarDirect self, ostream out)
- /**
This method is declared virtual in ConditionVarDebug, but non-virtual in
ConditionVarDirect.
*/
- wait()
C++ Interface: wait(const ConditionVarDirect self) wait(const ConditionVarDirect self, double timeout)
- /**
Waits on the condition. The caller must already be holding the lock
associated with the condition variable before calling this function.
wait() will release the lock, then go to sleep until some other thread
calls notify() on this condition variable. At that time at least one
thread waiting on the same ConditionVarDirect will grab the lock again, and
then return from wait().
It is possible that wait() will return even if no one has called notify().
It is the responsibility of the calling process to verify the condition on
return from wait, and possibly loop back to wait again if necessary.
Note the semantics of a condition variable: the mutex must be held before
wait() is called, and it will still be held when wait() returns. However,
it will be temporarily released during the wait() call itself.
*/
- /**
Waits on the condition, with a timeout. The function will return when the
condition variable is notified, or the timeout occurs. There is no way to
directly tell which happened, and it is possible that neither in fact
happened (spurious wakeups are possible).
See wait() with no parameters for more.
*/