wait¶
-
BetterEvent.
wait
(timeout: Optional[Union[int, float]] = None, fail=False) → bool[source]¶ Multi-purpose
wait
method which works similarly tothreading.Event.wait()
but with some extra features.This method’s behaviour will vary depending on what the
wait_on
setting is set to:'set'
- the default - works likethreading.Event
,wait()
only triggers when the event is in the “set” state, i.e._flag
isTrue
'clear'
- opposite of the default - works opposite tothreading.Event
,wait()
only triggers when the event is in the “clear” state, i.e._flag
isFalse
'both'
- In theboth
setting,wait()
will simply wait until_flag
is changed, whether fromset
toclear
, orclear
toset
. This wait_on setting only works as long asnotify_set
andnotify_clear
are set toTrue
- Parameters
- Return bool signal
This method returns the internal flag on exit, so it will always return
True
except if a timeout is given and the operation times out.