Message Queues and FIFOs

A message-queue is created by make-msgq-input-stream or make-msgq-output-stream. Each of these returns an instance of file-stream, which can then accept read and print operations like other streams connected to files. The fname slot of message-queue stream is set to the key when it is created.

To make a stream to FIFO, you first create a FIFO node with unix:mknod function by setting its second argument mode=#o10000, and you open it as a normal file. Message-queues and FIFOs are created locally on a machine and only provide communication channels within the machine.

Note that message-queues and FIFOs are not removed from the system even after the owner process terminates. Explicit use of unix:msgctl or ipcrm command is needed to delete them.



make-msgq-input-stream key &optional (buffer-size 128) [function]

returns an input file-stream which is connected to a message-queue identified by key.


make-msgq-output-stream key &optional (buffer-size 128) [function]

returns an output file-stream which is connected to a message-queue identified by key.


k-okada 2013-05-21