_lwp_sema_init man page on SmartOS

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

_LWP_SEMA_WAIT(2)					     _LWP_SEMA_WAIT(2)

NAME
       _lwp_sema_wait,	_lwp_sema_trywait,  _lwp_sema_init,  _lwp_sema_post  -
       semaphore operations

SYNOPSIS
       #include <sys/lwp.h>

       int _lwp_sema_wait(lwp_sema_t *sema);

       int _lwp_sema_trywait(lwp_sema_t *sema);

       int _lwp_sema_init(lwp_sema_t *sema, int count);

       int _lwp_sema_post(lwp_sema_t *sema);

DESCRIPTION
       Conceptually, a semaphore is an	non-negative  integer  count  that  is
       atomically  incremented	and decremented. Typically this represents the
       number of resources available. The _lwp_sema_init()  function  initial‐
       izes  the  count, _lwp_sema_post() atomically increments the count, and
       _lwp_sema_wait() waits for the count to become greater than 0 and  then
       atomically decrements it.

       LWP  semaphores	must  be initialized before use.  The _lwp_sema_init()
       function initializes  the  count	 associated  with  the	LWP  semaphore
       pointed to by sema to count.

       The  _lwp_sema_wait()  function	blocks the calling LWP until the sema‐
       phore count becomes greater than 0 and then atomically decrements it.

       The _lwp_sema_trywait() function atomically decrements the count if  it
       is greater than zero. Otherwise it returns an error.

       The  _lwp_sema_post()  function	atomically  increments	the  semaphore
       count.  If there	 are  any  LWPs	 blocked  on  the  semaphore,  one  is
       unblocked.

RETURN VALUES
       Upon  successful	 completion, 0 is returned. A non-zero value indicates
       an error.

ERRORS
       The  _lwp_sema_init(),	_lwp_sema_trywait(),   _lwp_sema_wait(),   and
       _lwp_sema_post() functions will fail if:

       EINVAL
		 The sema argument points to an invalid semaphore.

       EFAULT
		 The sema argument points to an illegal address.

       The  _lwp_sema_wait() function will fail if:

       EINTR
		The function execution was interrupted by a signal or fork(2).

       The  _lwp_sema_trywait() function will fail if:

       EBUSY
		The function was called on a semaphore with a zero count.

       The  _lwp_sema_post() function will fail if:

       EOVERFLOW
		    The value of the sema argument exceeds SEM_VALUE_MAX.

SEE ALSO
       fork(2)

				  May 8, 1998		     _LWP_SEMA_WAIT(2)
[top]

List of man pages available for SmartOS

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