The server process or any of its threads can empty a queue of all its elements by calling DosPurgeQueue. This function is not available to client processes.
Warning: This is an unconditional purge of all elements in the queue.
The following code fragment shows how the owner of a queue can empty the queue of all data elements. Assume that the owner of the queue has saved the queue's handle (obtained in a previous call to DosCreateQueue) in QueueHandle.
#define INCL_DOSQUEUES /* Queue values */ #include <os2.h> #include <stdio.h> HQUEUE hqQueueHandle; /* Queue handle */ APIRET ulrc; /* Return code */ ulrc = DosPurgeQueue(hqQueueHandle); if (ulrc != 0) { printf("DosPurgeQueue error: return code = %ld", ulrc); return; }