wait abstract method
Block and wait until another thread calls notify.
mutex
must be a Mutex object exclusively held by the current thread.
It will be released and the thread will block until another thread
calls notify.
if a timeout
is passed and it expires
then a TimeoutException is thrown.
Timeout resolution to microseconds is supported.
Implementation
void wait(Mutex mutex, {Duration? timeout});