All Manuals > LispWorks User Guide and Reference Manual > 44 The MP Package

NextPrevUpTopContentsIndex

mailbox-peek

Function
Summary

Returns the first object in a mailbox.

Package

mp

Signature

mailbox-peek mailbox => result, value-p

Arguments

mailbox

A mailbox.

Values

result

Any object or nil.

value-p

t or nil.

Description

The function mailbox-peek returns the first object in the mailbox without removing it. If the mailbox is empty, nil is returned.

If the mailbox mailbox is not empty, the function mailbox-peek returns the first object in the mailbox without removing it. The second returned value value-p is t.

If mailbox is empty, both return values result and value-p are nil.

Notes
  1. Since another process may modify the mailbox at any point, the result is not necessarily the next object that the next call to mailbox-read will read, unless no other process is reading from the mailbox.
  2. mailbox-peek needs to lock the mailbox, which means it is significantly slower than mailbox-not-empty-p, and also may affect other processes. In most cases, mailbox-not-empty-p is sufficient and hence is preferable.
See also

mailbox-empty-p
mailbox-not-empty-p
mailbox-send
mailbox-read
make-mailbox


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex