CreateUniqueSemaphore

Creates a semaphore with a unique name.

Synopsis

Item CreateUniqueSemaphore( const char *name, uint8 pri )

Description

This convenience procedure creates a semaphore item with the specified name and priority. You can use this procedure in place of CreateItem() to create the semaphore.

This function works much like CreateSemaphore(), except that it guarantees that no other semaphore item of the same name already exists. And once this semaphore created, no other semaphore of the same name is allowed to be created.

For information about semaphores, which are used to control access to shared resources, see the Sharing System Resources chapter in the 3DO Portfolio Programmer's Guide.

Arguments

name
The name of the semaphore (see "Notes").
pri
The priority of the semaphore; use 0 for now.

Return Value

The procedure returns the item number of the semaphore or an error code if an error occurs. If a semaphore of the same name already existed when this call was made, the ER_Kr_UniqueItemExists error will be returned.

Implementation

Convenience call implemented in clib.lib V24.

Associated Files

semaphore.h
ANSI C Prototype
clib.lib
ARM Link Library

Notes

When you no longer need a semaphore, use DeleteSemaphore() to delete it.

You can use FindSemaphore() to find a semaphore by name.

See Also

DeleteSemaphore(), LockSemaphore(), UnlockSemaphore()