High-level wrapper for a native named semaphore.

Static methods

@:value({ initialValue : 1 })staticopen(name:String, initialValue:Int = 1):NamedSemaphore

Opens or creates a named semaphore.

Parameters:

name

Unique system-wide name.

initialValue

Initial semaphore count.

Returns:

A NamedSemaphore instance if successful, null otherwise.

Methods

close():Void

Closes the local handle to the semaphore.

post():Bool

Increments the semaphore count.

Returns:

True if successfully incremented.

tryWait():Bool

Attempts to decrement the semaphore count without blocking.

Returns:

True if successfully decremented, false if it would have blocked.

unlink():Void

Removes the semaphore from the system.

wait():Bool

Decrements the semaphore count. Blocks if count is zero.

Returns:

True if successfully decremented.