Linking to a message queueΒΆ

link_msg_queue()

Linking to a message queue


SYNTAX

link_msg_queue(queue_name, options)

Link to the message queue whose name is queue_name. The message queue must have already have been created by another program, using the create_msg_queue() function. The values of queue_name and options must match the corresponding values in the call to create_msg_queue().

The return value from the function must be stored in an i4 type field. If the function was successful, the return value is used to identify this message queue in calls to other functions.

A return value of -1 means that the function failed. The normal reason for failure is that the message queue has not been created.

It is not necessary to unlink from a message queue, but the program that created the queue (or another program with sufficient privilege) should remove the queue when it is no longer required, because a message queue can survive in the system even after all programs using it have exited. See remove_msg_queue().


EXAMPLE

!temp msg_id,,i4

     msg_id = link_msg_queue("msg_abxf", SHM_USE_FTOK)
     if (msg_id == -1) {
          error "Error linking to message queue"
     }

Message queue functions

create_msgqueue()

Create a message queue

link_msg_queue()

Link to an existing message queue

read_msg_queue()

Read a message from a message queue

write_msg_queue()

Write a message to a message queue

remove_msg_queue()

Remove a message queue