From 75e5ba449f417d32aa0d2480d8eaf320a03a408b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Tue, 30 Jul 2024 07:51:44 -0700 Subject: [PATCH] Update documentation --- lib/mailbox.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/mailbox.dart b/lib/mailbox.dart index be89016..98e32fe 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(() { @@ -86,7 +87,7 @@ class Mailbox { /// Close a mailbox. /// - /// If mailbox already contains a message then it will be dropped. + /// If mailbox already contains a message then [close] will drop the message. void close() => _mutex.runLocked(() { if (_mailbox.ref.state == _stateFull && _mailbox.ref.bufferLength > 0) { malloc.free(_mailbox.ref.buffer); @@ -101,8 +102,8 @@ class Mailbox { /// Take a message from the mailbox. /// - /// If mailbox is empty this will synchronously block until message - /// is available. + /// If mailbox is empty then [take] will synchronously block until message + /// is available. If mailbox is closed then [take] will throw [StateError]. Uint8List take() => _mutex.runLocked(() { while (_mailbox.ref.state == _stateEmpty) { _condVar.wait(_mutex);