Jump to content

DevHelp SemClear: Difference between revisions

From EDM2
Created page with "This service releases a semaphore and restarts any blocked threads waiting on the semaphore. ==Syntax== ===C=== USHORT APIENTRY DevHelp_SemClear( ULONG SemHandle ); ===Asse..."
 
Ak120 (talk | contribs)
m creator seems to be lazy
 
Line 1: Line 1:
{{DISPLAYTITLE:DevHelp_SemClear}}
This service releases a semaphore and restarts any blocked threads waiting on the semaphore.
This service releases a semaphore and restarts any blocked threads waiting on the semaphore.


Line 24: Line 25:


==Return Code==
==Return Code==
===C===
===C===
Success Indicator: Clear if successful.
Success Indicator: Clear if successful.
Line 53: Line 53:
To access a RAM semaphore at interrupt time, the physical device driver must locate the semaphore in the physical device driver's data segment (DS). For a system semaphore, the caller must pass the handle to the physical device driver by way of a generic IOCtl. The device driver must convert the caller's handle to a system handle with SemHandle.
To access a RAM semaphore at interrupt time, the physical device driver must locate the semaphore in the physical device driver's data segment (DS). For a system semaphore, the caller must pass the handle to the physical device driver by way of a generic IOCtl. The device driver must convert the caller's handle to a system handle with SemHandle.


A RAM semaphore can be cleared at interrupt time only if it is in storage that is directly addressable by the physical device driver (that is, in the physical device driver's data segment).  
A RAM semaphore can be cleared at interrupt time only if it is in storage that is directly addressable by the physical device driver (that is, in the physical device driver's data segment).


==Example Code==
==Example Code==
Line 62: Line 62:
USHORT APIENTRY DevHelp_SemClear( ULONG SemHandle );
USHORT APIENTRY DevHelp_SemClear( ULONG SemHandle );
</PRE>
</PRE>
==Related Functions==


[[Category:DevHlps]]
[[Category:DevHlps]]

Latest revision as of 14:32, 2 January 2020

This service releases a semaphore and restarts any blocked threads waiting on the semaphore.

Syntax

C

USHORT APIENTRY DevHelp_SemClear( ULONG SemHandle );

Assembler

MOV   BX,sem_handle_low    ; Semaphore handle
MOV   AX,sem_handle_high   ;
MOV   DL,DevHlp_SemClear

CALL  [Device_Help]

Parameters

C

SemHandle (ULONG)
Semaphore handle

Assembler

MOV   BX,sem_handle_low    ; Semaphore handle
MOV   AX,sem_handle_high   ;

Return Code

C

Success Indicator: Clear if successful.

Possible errors:

              ERROR_INVALID_HANDLE                (6)
              ERROR_EXCL_SEM_AREADY_OWNED         (101)
              ERROR_INVALID_AT_INTERRUPT_TIME     (104)
              ERROR_PROTECTION_VIOLATION          (115)

Assembler

'C' Clear if successful.

'C' Set if error.
       AX = Error code.

Possible errors:
               ERROR_INVALID_HANDLE               (6)
               ERROR_EXCL_SEM_ALREADY_OWNED       (101)
               ERROR_INVALID_AT_INTERRUPT_TIME    (104)
               ERROR_PROTECTION_VIOLATION         (115)

Remarks

A physical device driver can clear either a RAM semaphore or a system semaphore. The physical device driver can obtain (own) a semaphore through SemRequest. The semaphore handle for a RAM semaphore is the virtual address of the doubleword of storage allocated for the semaphore.

To access a RAM semaphore at interrupt time, the physical device driver must locate the semaphore in the physical device driver's data segment (DS). For a system semaphore, the caller must pass the handle to the physical device driver by way of a generic IOCtl. The device driver must convert the caller's handle to a system handle with SemHandle.

A RAM semaphore can be cleared at interrupt time only if it is in storage that is directly addressable by the physical device driver (that is, in the physical device driver's data segment).

Example Code

C

#include  "dhcalls.h"

USHORT APIENTRY DevHelp_SemClear( ULONG SemHandle );