usinitsema man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



USINITSEMA(3P)							USINITSEMA(3P)

NAME
     usinitsema - initialize a semaphore

C SYNOPSIS
     #include <ulocks.h>

     int usinitsema (usema_t *sema, int val);

DESCRIPTION
     usinitsema initializes the semaphore specified by sema.  The count of the
     semaphore is set to the value specified by val. A value of 0 implies no
     available resources, and the first process that attempts a 'P' operation
     (via uspsema) will block.	This can be viewed as a synchronizing
     semaphore, since the goal is to always have a process block until another
     has completed an operation that the first process requires.  Positive
     values for val can be used for tracking a collection of resources.	 The
     simplest case of a value of 1 implements the common mutual exclusion
     semaphore, namely one and only one process will be permitted through a
     semaphore at a time.  Values greater than one imply that up to val
     resources may be simultaneously used, but requests for more than val
     resources cause the calling process to block until a resource comes free
     (by a process holding a resource performing a usvsema).

     Metering and debugging are reinitialized and the history logging
     mechanism is set according to the global setting (see usconfig(3P)).
     usinitsema should only be used for semaphores previously allocated using
     either usnewsema(3P) or usnewpollsema(3P).	 Note that usinitsema does not
     check whether any process is currently waiting for the semaphore.	Any
     such information is lost.	This means that any processes that are waiting
     for the semaphore (either blocked or queued on a pollable semaphore) will
     not be woken, nor will the internal counts kept in the operating system
     be reset.

     usinitsema will fail if the following is true:

     [EINVAL]	    val must be greater than or equal to 0 and less than
		    30000;

SEE ALSO
     uscpsema(3P), usctlsema(3P), usfreesema(3P), usinit(3P), usnewsema(3P),
     usnewpollsema(3P), uspsema(3P), usvsema(3P).

DIAGNOSTICS
     Upon successful completion, a value of 0 is returned. Otherwise, a value
     of -1 is returned and errno is set to indicate the error.

									Page 1

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net