diff --git a/lib/mailbox.dart b/lib/mailbox.dart index be89016..8dcdf8c 100644 --- a/lib/mailbox.dart +++ b/lib/mailbox.dart @@ -68,7 +68,8 @@ class Mailbox { /// Place a message into the mailbox if has space for it. /// - /// If mailbox already contains a message then [put] will throw. + /// If mailbox already contains a message or mailbox is closed then [put] will + /// throw [StateError]. void put(Uint8List message) { final buffer = message.isEmpty ? nullptr : _toBuffer(message); _mutex.runLocked(() { @@ -102,7 +103,7 @@ class Mailbox { /// Take a message from the mailbox. /// /// If mailbox is empty this will synchronously block until message - /// is available. + /// is available. If mailbox is closed [take] will throw [StateError]. Uint8List take() => _mutex.runLocked(() { while (_mailbox.ref.state == _stateEmpty) { _condVar.wait(_mutex);