Jump to content

DosMonClose: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:


==Parameters==
==Parameters==
;Handle (HMONITOR) - input : Device handle returned from a previous DosMonOpen call.
;Handle ([[HMONITOR]]) - input: Device handle returned from a previous [[DosMonOpen]] call.


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


==Remarks==
==Remarks==
A single process may register one or more monitors with a character device using the same device handle returned from a previous DosMonOpen call. When DosMonClose is issued for a specific, opened device handle, all monitors for the current process registered with this handle terminate.
A single process may register one or more monitors with a character device using the same device handle returned from a previous DosMonOpen call. When DosMonClose is issued for a specific, opened device handle, all monitors for the current process registered with this handle terminate.


When DosMonClose is issued, the monitor loses access to the device data stream. Before issuing DosMonClose, monitor threads calling DosMonRead and DosMonWrite should be terminated. After DosMonClose has been called:
When DosMonClose is issued, the monitor loses access to the device data stream. Before issuing DosMonClose, monitor threads calling [[DosMonRead]] and [[DosMonWrite]] should be terminated. After DosMonClose has been called:
* DosMonRead calls return an ERROR_MON_BUFFER_EMPTY return code.
* DosMonRead calls return an ERROR_MON_BUFFER_EMPTY return code.
* DosMonWrite calls return an ERROR_NOT_ENOUGH_MEMORY return code.
* DosMonWrite calls return an ERROR_NOT_ENOUGH_MEMORY return code.
Data segments containing monitor buffers should not be freed until after DosMonClose is called. If data segments containing monitor buffers are freed before DosMonClose is called, a GP fault occurs when DosMonClose is called and the process is terminated.
Data segments containing monitor buffers should not be freed until after DosMonClose is called. If data segments containing monitor buffers are freed before DosMonClose is called, a GP fault occurs when DosMonClose is called and the process is terminated.


For a detailed description of this call see the chapter "Character Device Monitors" in the IBM Operating System/2 Version 1.2 I/O Subsystems And Device Support Volume 1.
For a detailed description of this call see the chapter "Character Device Monitors" in the ''IBM Operating System/2 Version 1.2 I/O Subsystems and Device Support Volume 1''.


==Example Code==
==Bindings==
=== C Binding===
===C===
  #define INCL_DOSMONITORS
  #define INCL_DOSMONITORS
  USHORT    rc = DosMonClose(Handle);
  USHORT    rc = DosMonClose(Handle);
Line 30: Line 29:
  USHORT    rc;      /* return code    */
  USHORT    rc;      /* return code    */


===MASM Binding===
===MASM===
  EXTRN  DosMonClose:FAR
  EXTRN  DosMonClose:FAR
  INCL_DOSMONITORS    EQU 1
  INCL_DOSMONITORS    EQU 1
Line 39: Line 38:
  Returns WORD
  Returns WORD


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

Latest revision as of 04:53, 26 January 2020

This call terminates character device monitoring. All monitor buffers associated with this process are flushed and closed.

Syntax

DosMonClose (Handle)

Parameters

Handle (HMONITOR) - input
Device handle returned from a previous DosMonOpen call.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 - NO_ERROR
  • 381 - ERROR_MON_INVALID_HANDLE

Remarks

A single process may register one or more monitors with a character device using the same device handle returned from a previous DosMonOpen call. When DosMonClose is issued for a specific, opened device handle, all monitors for the current process registered with this handle terminate.

When DosMonClose is issued, the monitor loses access to the device data stream. Before issuing DosMonClose, monitor threads calling DosMonRead and DosMonWrite should be terminated. After DosMonClose has been called:

  • DosMonRead calls return an ERROR_MON_BUFFER_EMPTY return code.
  • DosMonWrite calls return an ERROR_NOT_ENOUGH_MEMORY return code.

Data segments containing monitor buffers should not be freed until after DosMonClose is called. If data segments containing monitor buffers are freed before DosMonClose is called, a GP fault occurs when DosMonClose is called and the process is terminated.

For a detailed description of this call see the chapter "Character Device Monitors" in the IBM Operating System/2 Version 1.2 I/O Subsystems and Device Support Volume 1.

Bindings

C

#define INCL_DOSMONITORS
USHORT     rc = DosMonClose(Handle);
HMONITOR   Handle;   /* Monitor handle */
USHORT     rc;       /* return code    */

MASM

EXTRN  DosMonClose:FAR
INCL_DOSMONITORS    EQU 1

PUSH   WORD    Handle   ;Monitor handle
CALL   DosMonClose

Returns WORD