USNEWLOCK(3P) USNEWLOCK(3P)
usnewlock - allocate and initialize a lock
#include <ulocks.h>
ulock_t usnewlock (usptr_t *handle);
usnewlock allocates a lock from the arena designated by handle (returned
from usinit(3P)) and initializes it and all associated data. There are
different types of locks; by default the fastest lock type for the class
of machine the process is running on is allocated. See usconfig(3P) for
other specifiable lock types. Metering and debugging are only enabled if
the locks are of the debugging type (see usconfig(3P). There is a limit
of a maximum of 4096 locks per shared area (for hardware supported
locks). The size of the shared arena can also limit the number of locks
that can be allocated.
usnewlock will fail if one or more of the following are true:
[ENOMEM] There is no memory in the arena available to allocate the
lock structure (see usconfig(3P)).
[ENOSPC] If the system imposed maximum (4096) number of allocatable
locks has been exceeded.
[ENOSPC] All the locks in the system have been allocated.
usconfig(3P), usctllock(3P), usfreelock(3P), usinit(3P), usinitlock(3P),
usnewsema(3P), usnewpollsema(3P), ussetlock(3P).
Upon successful completion, a ulock_t structure is returned, otherwise
NULL is returned and errno is set to indicate the error.
PPPPaaaaggggeeee 1111 [ Back ]
|