ENGSAFESEMAPHORE structure

The ENGSAFESEMAPHORE structure provides the driver with a thread-safe semaphore.

Syntax


typedef struct _ENGSAFESEMAPHORE {
  HSEMAPHORE hsem;
  LONG       lCount;
} ENGSAFESEMAPHORE;

Members

hsem

Handle to the semaphore.

lCount

Specifies the reference count on the semaphore.

Remarks

A safe semaphore is a wrapper that contains a handle to a semaphore and a reference count on that semaphore.

The driver allocates an ENGSAFESEMAPHORE structure and passes it to EngInitializeSafeSemaphore for initialization. GDI operates the safe semaphore under a lock and maintains a reference count on it, making it suitable for multithreading.

Once the safe semaphore is initialized, the driver can call EngAcquireSemaphore and EngReleaseSemaphore with the hsem for synchronization.

Requirements

Header

Winddi.h (include Winddi.h)

See also

EngAcquireSemaphore
EngDeleteSafeSemaphore
EngInitializeSafeSemaphore
EngReleaseSemaphore

 

 

Send comments about this topic to Microsoft

Show: