LockSemaphore

Locks a semaphore.

Synopsis

int32 LockSemaphore( Item s, uint32 flags )

Description

This procedure locks a semaphore. For information about semaphores, which are used to control access to shared resources, see the "Sharing System Resources" chapter in the 3DO System Programmer's Guide.

Arguments

s
The number of the semaphore to be locked.
flags
Semaphore flags.
Only one flag is currently defined:

SEM_WAIT
If the item to be locked is already locked, put the calling task into wait state until the item is available.

Return Value

The procedure returns 1 if the semaphore was successfully locked. If the semaphore is already locked and the SEM_WAIT flag is not set (which indicates that the calling task does not want to wait until the semaphore is available), the procedure returns 0. If an error occurs, the procedure returns an error code.

Implementation

SWI implemented in kernel folio V20.

This is the same SWI as LockItem().

Associated Files

semaphore.h
ANSI C Prototype

Caveats

There are currently no asynchronous locks or shared read locks.

See Also

FindSemaphore(), UnlockSemaphore()