ReleaseSemaphore Function

Action

Increases the value of a given semaphore object by a specified amount.

Include file

Kernel.bdh

Syntax

ReleaseSemaphore(in hSemaphore : number,
in nIncrease : number,
out nValue : number optional): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hSemaphore Handle to a semaphore object
nIncrease Amount by which the semaphore object's current value is increased
nValue Variable receiving the semaphore object's value before the value is incremented (optional)

Example

dcltrans
transaction TMain
const
MAX_USERS := 25;
var
hSemaphore: number;
begin
hSemaphore := CreateSemaphore(NULL, MAX_USERS,
MAX_USERS, "semaphore");
...
WaitForSingleObject(hSemaphore, INFINITE);
// perform critical work
...
ReleaseSemaphore(hSemaphore, 1);
...
end TMain;