take method

Uint8List take({
  1. Duration? timeout,
})

Take a message from the mailbox.

If the mailbox is empty this will synchronously block until message is available or a timeout occurs. If the mailbox is closed then take will throw MailBoxClosedException.

If not timeout is provided then this method will block indefinitely.

If timeout is provided then this limits the wait for a message. Reacquiring the mutex after a condition wait can exceed this duration. If the timeout expires before a message is available then this will throw a TimeoutException. Windows condition waits round up to milliseconds; POSIX supports microseconds.

Implementation

Uint8List take({Duration? timeout}) {
  if (timeout != null) {
    return _takeTimed(timeout);
  } else {
    return _take();
  }
}