INtime SDK Help
CreateRtQueue
INtime SDK v7.1 > About INtime > INtime Kernel > Message Queues > CreateRtQueue

Creates a message queue object. The threshold and queue size determine the number of messages which may be received in the queue object.

RTHANDLE CreateRtQueue(
DWORD queueSize,
DWORD msgThreshold,
DWORD flags);

Parameters

queueSize
The total size of the queue buffer. Note that there is an overhead of 30 bytes per message in the buffer.
This value must be at least 32 bytes.
msgThreshold
The maximum number of bytes in a short message in this queue. Messages longer than this will be delivered as long messages. This is an arbitrary value which determines the method used to send the message. If you do not wish to send short messages, this value may be set to 0 which will force all messages to be sent as long messages.
flags
(reserved for future use, set to 0).

Returns

Returns a valid queue handle on success, or else BAD_RTHANDLE to indicate failure. The failure status is returned from GetLastRtError(). Status codes returned from this call include:

E_MEM Not enough memory available to create this object
E_PARAM The queueSize parameter is less than the minimum allowed or the msgThreshold parameter is out of range.
E_SLOT The system has reached its object limit
E_LIMIT The calling process has reached its object limit

Example

#define MAX_MSG_SIZE 100
#define MAX_MSG_CNT 100
#define MSG_OVERHEAD 30

DWORD qsize;

/* Note: if some messages are smaller than MAX_MSG_SIZE, more than MAX_MSG_CNT messages may fit in the queue */

qsize = MSG_MAX_CNT * (MAX_MSG_SIZE + MSG_OVERHEAD)

h = CreateRtQueue(qsize, MAX_MSG_SIZE, 0);

Requirements

Versions Defined in Include Link to
INtime 5.0 intime/rt/include/rtbase.h rt.h rt.lib
See Also