Haiku API Bindings
MessageQueue
Not logged in

Documentation | ApplicationKit | MessageQueue

SYNOPSIS

Perl

use HaikuR1::MessageQueue;

my $queue = HaikuR1::MessageQueue->new();
$queue->AddMessage($message);
my $count = $queue->CountMessages();

Python

from HaikuR1.ApplicationKit import MessageQueue

queue = MessageQueue()
queue.AddMessage(message)
count = queue.CountMessages()

DESCRIPTION

Exposes the MessageQueue object.

For more information on MessageQueue, see the Be Book class description, the Be Book overview, and the Haiku Book class description.

METHODS

Constructor

Creates a MessageQueue object.

Perl

HaikuR1::MessageQueue->new();

Python

MessageQueue()

AddMessage

Add a Message to the end of the queue.

Perl

$queue->AddMessage($message);

Python

queue.AddMessage(message)

CountMessages

Returns the number of Messages in the queue.

Perl

$queue->CountMessages();

Python

queue.CountMessages()

FindMessage

Returns the nth Message with the given what value.

Perl

$queue->FindMessage($what, $index);

Python

queue.FindMessage(what, index)

IsEmpty

Returns true if the queue is empty.

Perl

$queue->IsEmpty();

Python

queue.IsEmpty()

IsNextMessage

Returns true if the given Message is the next message in the queue.

Perl

$queue->IsNextMessage($message);

Python

queue.IsNextMessage(message)

Locking

Lock

Unlock

IsLocked

These methods do what you expect.

Lock will block until a lock is obtained.

Perl

$queue->Lock();
$queue->Unlock();
$queue->IsLocked();

Python

queue.Lock()
queue.Unlock()
queue.IsLocked()

NextMessage

Removes and returns the next (i.e., oldest) Message in the queue, or the empty value if the queue is empty.

Perl

$queue->NextMessage();

Python

queue.NextMessage()

RemoveMessage

Remove a Message from the queue.

Perl

$queue->RemoveMessage($message);

Python

queue.RemoveMessage(message)