DevHelp_SemClear
This service releases a semaphore and restarts any blocked threads waiting on the semaphore.
Contents
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 );