Jump to content

DosCloseQueue (OS/2 1.x): Difference between revisions

From EDM2
Ak120 (talk | contribs)
Ak120 (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 8: Line 8:


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
Return code descriptions are:
*0 NO_ERROR
* 0         NO_ERROR  
*337 ERROR_QUE_INVALID_HANDLE
* 337       ERROR_QUE_INVALID_HANDLE  


==Remarks==
==Remarks==
DosCloseQueue is used to terminate further processing of a queue by the requesting process. The actions taken depend on whether the requestor is the owner or a writer of the queue. For all processes, an access count representing all DosOpenQueue calls performed is decremented. For non-owning processes, access is terminated when this count goes to zero. For owning processes, the queue (and its elements) are purged if the access count previously equaled zero. Other processes that have the queue open receive the ERROR_QUE_INVALID_HANDLE return code on their next request.  
DosCloseQueue is used to terminate further processing of a queue by the requesting process. The actions taken depend on whether the requestor is the owner or a writer of the queue. For all processes, an access count representing all DosOpenQueue calls performed is decremented. For non-owning processes, access is terminated when this count goes to zero. For owning processes, the queue (and its elements) are purged if the access count previously equaled zero. Other processes that have the queue open receive the ERROR_QUE_INVALID_HANDLE return code on their next request.


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSQUEUES
#define INCL_DOSQUEUES
Line 23: Line 22:
USHORT  rc = DosCloseQueue(QueueHandle);
USHORT  rc = DosCloseQueue(QueueHandle);


HQUEUE           QueueHandle;  /* Handle of queue */
HQUEUE QueueHandle;  /* Handle of queue */
USHORT  rc;            /* return code */
</PRE>
 
===MASM===
<PRE>
EXTRN  DosCloseQueue:FAR
INCL_DOSQUEUES      EQU 1


USHORT          rc;           /* return code */
PUSH  WORD    QueueHandle  ;Queue handle
CALL  DosCloseQueue
 
Returns WORD
</PRE>
</PRE>
This example opens a queue named special.que, then closes it.


==Example==
This example opens a queue named special.que, then closes it.
<PRE>
<PRE>
#define INCL_DOSQUEUES
#define INCL_DOSQUEUES
Line 38: Line 48:
USHORT rc;
USHORT rc;


   if(!DosCreateQueue(&QueueHandle,       /* Queue handle */
   if(!DosCreateQueue(&QueueHandle,   /* Queue handle */
                       QUE_FIFO,           /* Ordering to use for
                       QUE_FIFO,       /* Ordering to use for elements */
                                                  elements */
                       QUE_NAME))       /* Queue name string */
                       QUE_NAME))           /* Queue name string */
       rc = DosCloseQueue(QueueHandle); /* Queue handle */
       rc = DosCloseQueue(QueueHandle);     /* Queue handle */
</PRE>
 
===MASM Binding===
<PRE>
EXTRN  DosCloseQueue:FAR
INCL_DOSQUEUES      EQU 1
 
PUSH  WORD    QueueHandle  ;Queue handle
CALL  DosCloseQueue
 
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


[[Category:Dos]]
[[Category:Dos16]]

Latest revision as of 23:33, 25 January 2020

This call closes the queue in use by the requesting process.

Syntax

DosCloseQueue (QueueHandle)

Parameters

QueueHandle (HQUEUE) - input
Handle returned from a previous DosCreateQueue or DosOpenQueue call.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 337 ERROR_QUE_INVALID_HANDLE

Remarks

DosCloseQueue is used to terminate further processing of a queue by the requesting process. The actions taken depend on whether the requestor is the owner or a writer of the queue. For all processes, an access count representing all DosOpenQueue calls performed is decremented. For non-owning processes, access is terminated when this count goes to zero. For owning processes, the queue (and its elements) are purged if the access count previously equaled zero. Other processes that have the queue open receive the ERROR_QUE_INVALID_HANDLE return code on their next request.

Bindings

C

#define INCL_DOSQUEUES

USHORT  rc = DosCloseQueue(QueueHandle);

HQUEUE  QueueHandle;   /* Handle of queue */
USHORT  rc;            /* return code */

MASM

EXTRN  DosCloseQueue:FAR
INCL_DOSQUEUES      EQU 1

PUSH   WORD    QueueHandle   ;Queue handle
CALL   DosCloseQueue

Returns WORD

Example

This example opens a queue named special.que, then closes it.

#define INCL_DOSQUEUES

#define QUE_FIFO 0
#define QUE_NAME "\\QUEUES\\special.que"

HQUEUE QueueHandle;
USHORT rc;

   if(!DosCreateQueue(&QueueHandle,    /* Queue handle */
                      QUE_FIFO,        /* Ordering to use for elements */
                      QUE_NAME))       /* Queue name string */
      rc = DosCloseQueue(QueueHandle); /* Queue handle */