A thread creates a queue by using DosCreateQueue and specifying a queue name and the queue type as arguments. The queue name must be unique and have the following form:
\QUEUES\QueName
The "\QUEUES\" is required, though it need not be uppercase. It is not a subdirectory.
The QueName parameter must conform to the rules for OS/2 file names, although no actual file is created for the queue.
The process that creates the queue is known as the server process of the queue. The other processes that access the queue are known as client processes.
The following code fragment creates a FIFO queue named \queues\sample.que:
#define INCL_DOSQUEUES /* Queue values */ #include <os2.h> HQUEUE hq; DosCreateQueue(&hq, QUE_FIFO | QUE_CONVERT_ADDRESS, "\\queues\\sample.que");
When the server process creates the queue, it determines whether the ordering of queue elements is based on arrival (FIFO or LIFO) or priority. If the ordering is based on priority, then priority values must be assigned whenever data is added to the queue.
The server must also specify whether OS/2 is to convert 16-bit addresses of elements placed in the queue by 16-bit processes to 32-bit addresses.
After a process has created a queue, any thread in that process can access the queue with equal authority.