Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Message Queue Overview

A message queue is a mechanism for passing data:

The mechanism provides a way to send data (messages) to an interested party without needing to know whether anyone is listening nor needing to know the identity of a recipient.

A message is an object, usually an instance of a class, that is placed into a queue for delivery to recipients. A queue is normally created to deal with messages of a given type. This means that a queue is created to deal with messages of a defined (fixed) length. The size of a queue, i.e. the maximum number of messages, or slots, it can contain is defined and fixed when the queue is created. The size of message for which a queue is created, and the size of the queue is arbitrary, being limited only by system resources.

A single queue can be shared by many readers and writers.

A message queue is represented by a DMsgQueue kernel side object, to which the reader and the writer can open a handle, a RMsgQueue object. A message queue is a reference counted object, being derived from CObject, which means that it is not persistent; it is deleted when the last handle to it is closed. The queue itself is simply a block of memory divided into slots, managed by the DMsgQueue object.


[Top]


Handle to a message queue

A message queue is created, opened, written to and read from through a message queue handle, a RMsgQueue object. This is a templated class, where the template parameter defines the message type.

RMsgQueue is derived from RMsgQueueBase, which together form a thin template class/base class pair. RMsgQueueBase provides the implementation, while RMsgQueue provides type safety. An RMsgQueueBase object is a valid message queue handle, but does not offer the type safety that RMsgQueue does.


As a queue can be accessed by any number of readers and writers, the general picture is as shown here, where Msg Q handle represents a RMsgQueueBase or a RMsgQueue object:


[Top]


Visibility of a message queue

A message queue can be: