ClassesClasses | | Operators

create_message_queuecreate_message_queueCreateMessageQueueCreateMessageQueue (Operator)

Name

create_message_queuecreate_message_queueCreateMessageQueueCreateMessageQueue — Create a new empty message queue.

Signature

create_message_queue( : : : QueueHandle)

Herror create_message_queue(Hlong* QueueHandle)

Herror T_create_message_queue(Htuple* QueueHandle)

void CreateMessageQueue(HTuple* QueueHandle)

void HMessageQueue::HMessageQueue()

void HMessageQueue::CreateMessageQueue()

static void HOperatorSet.CreateMessageQueue(out HTuple queueHandle)

public HMessageQueue()

void HMessageQueue.CreateMessageQueue()

Description

create_message_queuecreate_message_queueCreateMessageQueueCreateMessageQueueCreateMessageQueue creates a new empty message queue. The output parameter QueueHandleQueueHandleQueueHandleQueueHandlequeueHandle is a handle to the newly created message queue and is used to identify the queue in any subsequent operator calls using the queue.

The message queues are designed as FIFO pipes delivering arbitrary sets of data safely among different threads. The queue access is internally fully synchronized, no explicit locking is required from the application. The data is traveling through the queue in so called messages (see create_messagecreate_messageCreateMessageCreateMessageCreateMessage).

Multiple producer threads can append data simultaneously (enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessage) while multiple consumer threads are simultaneously retrieving the data again (dequeue_messagedequeue_messageDequeueMessageDequeueMessageDequeueMessage). Multiple messages can be enqueued together using a single enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessage operation. In such case, those messages will travel together through the queue and will be delivered through a single dequeue_messagedequeue_messageDequeueMessageDequeueMessageDequeueMessage call.

All the enqueued messages are copied by the enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessage operation. The original message(s) can thus be immediately reused after the enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessage call without affecting the enqueued copy.

When the message queue is no more needed, all associated resources, in particular the yet enqueued messages with all data they carry, should be released using clear_message_queueclear_message_queueClearMessageQueueClearMessageQueueClearMessageQueue. Depending on the context, releasing any threads waiting for the queue data and flushing the queue contents might be required using set_message_queue_paramset_message_queue_paramSetMessageQueueParamSetMessageQueueParamSetMessageQueueParam before clearing the queue.

Execution Information

Parameters

QueueHandleQueueHandleQueueHandleQueueHandlequeueHandle (output_control)  message_queue HMessageQueue, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Handle of the newly created message queue.

Number of elements: QueueHandle == 1

Assertion: QueueHandle != 0

Example (HDevelop)

create_message_queue (ProducerQueue)
create_message_queue (ResultQueue)
* ...
clear_message_queue ([ProducerQueue,ResultQueue])

Result

Returns 2 (H_MSG_TRUE) unless a resource allocation error occurs. Otherwise an exception is raised.

Possible Successors

enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessage, dequeue_messagedequeue_messageDequeueMessageDequeueMessageDequeueMessage

See also

clear_message_queueclear_message_queueClearMessageQueueClearMessageQueueClearMessageQueue, enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessage, dequeue_messagedequeue_messageDequeueMessageDequeueMessageDequeueMessage, set_message_queue_paramset_message_queue_paramSetMessageQueueParamSetMessageQueueParamSetMessageQueueParam, get_message_queue_paramget_message_queue_paramGetMessageQueueParamGetMessageQueueParamGetMessageQueueParam, create_messagecreate_messageCreateMessageCreateMessageCreateMessage, clear_messageclear_messageClearMessageClearMessageClearMessage, set_message_tupleset_message_tupleSetMessageTupleSetMessageTupleSetMessageTuple, get_message_tupleget_message_tupleGetMessageTupleGetMessageTupleGetMessageTuple, set_message_objset_message_objSetMessageObjSetMessageObjSetMessageObj, get_message_objget_message_objGetMessageObjGetMessageObjGetMessageObj

Module

Foundation


ClassesClasses | | Operators