Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DosCreateQueue (1.2)
◄Function Group► ◄Overview► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_DOSQUEUES
USHORT DosCreateQueue(phqueue, fQueueOrder, pszQueueName)
PHQUEUE phqueue; /* pointer to variable for queue handle */
USHORT fQueueOrder; /* order in which elements are read-written */
PSZ pszQueueName; /* pointer to queue name */
The DosCreateQueue function creates and opens a queue. The new queue is
owned by the process that calls the function, but can be opened for use by
other processes.
Parameter Description
────────────────────────────────────────────────────────────────────────────
phqueue Points to the variable that receives the queue handle.
fQueueOrder Specifies the order in which elements are read from and
written to the queue. This parameter can be one of the
following values:
Value Meaning
──────────────────────────────────────────────────────────────
QUE_FIFO First-in/first-out queue. The first element put
in the queue is the first element to be
removed.
QUE_LIFO Last-in/first-out queue. The last element put in
the queue is the first element to be removed.
QUE_PRIORITY Priority queue. The process that places the
element in the queue specifies a priority.
Elements with the highest priority are removed
first.
pszQueueName Points to a null-terminated string. The string identifies the
queue and must have the following form:
\queues\name
The string name, name, must have the same format as an MS OS/2
filename and must be unique.
Return Value
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
ERROR_QUE_DUPLICATE
ERROR_QUE_INVALID_NAME
ERROR_QUE_INVALID_PRIORITY
ERROR_QUE_NO_MEMORY
Comments
The process that creates a queue owns that queue. The owning process can
write elements to and read elements from the queue at any time, since
DosCreateQueue automatically opens the queue for the owning process. Other
processes may open the queue by using the DosOpenQueue function and write
elements to it by using the DosWriteQueue function, but they cannot read
elements from the queue. Any thread belonging to the process that owns a
queue can read from or write to the queue.
If any process has a queue open when the owner closes it, subsequent
requests to write to the queue return an error value.
Example
This example creates and opens a queue, then calls the DosCloseQueue
function to close the queue:
HQUEUE hqueue;
DosCreateQueue(&hqueue, /* receives the handle of the queue */
QUE_FIFO, /* specifies the queue order */
"\\queues\\quename"); /* specifies the queue name */
.
. /* read the queue and process the data
.
DosCloseQueue(hqueue);
See Also
DosCloseQueue, DosOpenQueue, DosWrite
♦