Jump to content

DosFSRamSemClear: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
{{Legacy
|RepFunc=
|Remarks=This page list the older version of the function for reference.
}}
This call releases ownership of a Fast-Safe (FS) RAM semaphore.
This call releases ownership of a Fast-Safe (FS) RAM semaphore.


Line 9: Line 5:


==Parameters==
==Parameters==
;FSRamSemStructure (PDOSFSRSEM) - input : Address of the FS RAM Semaphore data structure. The content/format of this structure is shown in DosFSRamSemRequest.
;FSRamSemStructure (PDOSFSRSEM) - input: Address of the FS RAM Semaphore data structure. The content/format of this structure is shown in DosFSRamSemRequest.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code description is:
Return code description is:
*0 NO_ERROR
*0   NO_ERROR


==Remarks==
==Remarks==
DosFSRamSemClear decrements fs_UseCount, which is incremented by [[DosFSRamSemRequest]]. Recursive requests for FS RAM semaphores are supported by this use count, which keeps track of the number of times the owner has issued a DosFSRamSemRequest without a corresponding DosFSRamSemClear. If the call to DosFSRamSemClear decrements the use count to zero, the semaphore is set unowned, and any threads that were blocked waiting for the semaphore resume execution.
DosFSRamSemClear decrements fs_UseCount, which is incremented by [[DosFSRamSemRequest]]. Recursive requests for FS RAM semaphores are supported by this use count, which keeps track of the number of times the owner has issued a DosFSRamSemRequest without a corresponding DosFSRamSemClear. If the call to DosFSRamSemClear decrements the use count to zero, the semaphore is set unowned, and any threads that were blocked waiting for the semaphore resume execution.


DosFSRamSemClear cannot be issued against a FS RAM semaphore that is owned by another thread.  
DosFSRamSemClear cannot be issued against a FS RAM semaphore that is owned by another thread.


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
typedef struct _DOSFSRSEM {   /* dosfsrs */
typedef struct _DOSFSRSEM { /* dosfsrs */
   
   
   USHORT cb;                 /* Length of this structure (bytes) */
   USHORT cb;               /* Length of this structure (bytes) */
   PID    pid;                 /* Process ID of owner or zero */
   PID    pid;               /* Process ID of owner or zero */
   TID    tid;                 /* Thread ID of owner or zero */
   TID    tid;               /* Thread ID of owner or zero */
   USHORT cUsage;             /* Reference count */
   USHORT cUsage;           /* Reference count */
   USHORT client;             /* 16 bit field for use by owner */
   USHORT client;           /* 16 bit field for use by owner */
   ULONG  sem;                 /* OS/2 Ram Semaphore */
   ULONG  sem;               /* OS/2 Ram Semaphore */
   
   
} DOSFSRSEM;
} DOSFSRSEM;
Line 39: Line 34:
USHORT  rc = DosFSRamSemClear(FSRamSemStructure);
USHORT  rc = DosFSRamSemClear(FSRamSemStructure);


PDOSFSRSEM       FSRamSemStructure;  /* Address of structure */
PDOSFSRSEM   FSRamSemStructure;  /* Address of structure */
USHORT      rc;                /* return code */
</PRE>
 
===MASM===
<PRE>
DOSFSRSEM struc
  dosfsrs_cb      dw  ? ;length of this structure (bytes)
  dosfsrs_pid    dw  ? ;Process ID of owner or zero
  dosfsrs_tid    dw  ? ;Thread ID of owner or zero
  dosfsrs_cUsage  dw  ? ;reference count
  dosfsrs_client  dw  ? ;16 bit field for use by owner
  dosfsrs_sem    dd  ? ;OS/2 Ram Semaphore
DOSFSRSEM ends


USHORT          rc;                 /* return code */
EXTRN  DosFSRamSemClear:FAR
INCL_DOSSEMAPHORES  EQU 1
 
PUSH@  OTHER  FSRamSemStructure ;FS Ram Semaphore data structure
CALL  DosFSRamSemClear
 
Returns WORD
</PRE>
</PRE>
Example


This example requests a FS RAM semaphore and then clears it.  
==Example==
This example requests a FS RAM semaphore and then clears it.
<PRE>
<PRE>
#define INCL_DOSSEMAPHORES
#define INCL_DOSSEMAPHORES
Line 64: Line 78:
   SemStruct.sem = START_LONG;
   SemStruct.sem = START_LONG;


   if(!DosFSRamSemRequest(&SemStruct,         /* Address of structure */
   if(!DosFSRamSemRequest(&SemStruct,     /* Address of structure */
                           TIME_OUT))         /* Timeout */
                           TIME_OUT))     /* Timeout */
       rc = DosFSRamSemClear(&SemStruct);     /* Address of structure */
       rc = DosFSRamSemClear(&SemStruct); /* Address of structure */
</PRE>
</PRE>


===MASM Binding===
<PRE>
DOSFSRSEM struc
  dosfsrs_cb      dw  ? ;length of this structure (bytes)
  dosfsrs_pid    dw  ? ;Process ID of owner or zero
  dosfsrs_tid    dw  ? ;Thread ID of owner or zero
  dosfsrs_cUsage  dw  ? ;reference count
  dosfsrs_client  dw  ? ;16 bit field for use by owner
  dosfsrs_sem    dd  ? ;OS/2 Ram Semaphore
DOSFSRSEM ends
EXTRN  DosFSRamSemClear:FAR
INCL_DOSSEMAPHORES  EQU 1
PUSH@  OTHER  FSRamSemStructure ;FS Ram Semaphore data structure
CALL  DosFSRamSemClear
Returns WORD
</PRE>
==Related Functions==
==Related Functions==
*[[DosFSRamSemRequest]]
*[[DosFSRamSemRequest]]


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

Revision as of 22:32, 9 September 2018

This call releases ownership of a Fast-Safe (FS) RAM semaphore.

Syntax

DosFSRamSemClear (FSRamSemStructure)

Parameters

FSRamSemStructure (PDOSFSRSEM) - input
Address of the FS RAM Semaphore data structure. The content/format of this structure is shown in DosFSRamSemRequest.

Return Code

rc (USHORT) - return
Return code description is:
  • 0 NO_ERROR

Remarks

DosFSRamSemClear decrements fs_UseCount, which is incremented by DosFSRamSemRequest. Recursive requests for FS RAM semaphores are supported by this use count, which keeps track of the number of times the owner has issued a DosFSRamSemRequest without a corresponding DosFSRamSemClear. If the call to DosFSRamSemClear decrements the use count to zero, the semaphore is set unowned, and any threads that were blocked waiting for the semaphore resume execution.

DosFSRamSemClear cannot be issued against a FS RAM semaphore that is owned by another thread.

Bindings

C

typedef struct _DOSFSRSEM { /* dosfsrs */
 
  USHORT cb;                /* Length of this structure (bytes) */
  PID    pid;               /* Process ID of owner or zero */
  TID    tid;               /* Thread ID of owner or zero */
  USHORT cUsage;            /* Reference count */
  USHORT client;            /* 16 bit field for use by owner */
  ULONG  sem;               /* OS/2 Ram Semaphore */
 
} DOSFSRSEM;

#define INCL_DOSSEMAPHORES

USHORT  rc = DosFSRamSemClear(FSRamSemStructure);

PDOSFSRSEM   FSRamSemStructure;  /* Address of structure */
USHORT       rc;                 /* return code */

MASM

DOSFSRSEM struc
  dosfsrs_cb      dw  ? ;length of this structure (bytes)
  dosfsrs_pid     dw  ? ;Process ID of owner or zero
  dosfsrs_tid     dw  ? ;Thread ID of owner or zero
  dosfsrs_cUsage  dw  ? ;reference count
  dosfsrs_client  dw  ? ;16 bit field for use by owner
  dosfsrs_sem     dd  ? ;OS/2 Ram Semaphore
DOSFSRSEM ends

EXTRN  DosFSRamSemClear:FAR
INCL_DOSSEMAPHORES  EQU 1

PUSH@  OTHER   FSRamSemStructure ;FS Ram Semaphore data structure
CALL   DosFSRamSemClear

Returns WORD

Example

This example requests a FS RAM semaphore and then clears it.

#define INCL_DOSSEMAPHORES

#define NOT_OWNED 0
#define START 0
#define START_LONG 0L
#define TIME_OUT 1000L

DOSFSRSEM SemStruct;
USHORT    rc;

   SemStruct.cb = sizeof(SemStruct);   /* Initialize FS Sem */
   SemStruct.pid = NOT_OWNED;
   SemStruct.tid = NOT_OWNED;
   SemStruct.cUsage = START;
   SemStruct.client = START;
   SemStruct.sem = START_LONG;

   if(!DosFSRamSemRequest(&SemStruct,     /* Address of structure */
                          TIME_OUT))      /* Timeout */
      rc = DosFSRamSemClear(&SemStruct);  /* Address of structure */

Related Functions