Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Jul 30, 2024
1 parent 529881e commit 75e5ba4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/mailbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(() {
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 75e5ba4

Please sign in to comment.