sem_trywait man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

sem_wait(2)							   sem_wait(2)

NAME
       sem_wait, sem_trywait - lock a POSIX semaphore

SYNOPSIS
DESCRIPTION
       is  used	 to lock a semaphore.  The calling thread will not return from
       its call to until one of the following events  occur:  it  successfully
       obtains	a  lock	 on the semaphore; it is interrupted by a signal or an
       error condition occurs.

       is used to lock a semaphore, if it is available.	 The value of the sem‐
       aphore sem is checked at some unspecified time during the call.	If the
       semaphore is available at the time its value is	checked,  the  calling
       thread will atomically, with respect to the checking of the value, lock
       the semaphore.  The thread will now own a lock on  the  semaphore;  the
       call  will return successfully.	If the semaphore is unavailable at the
       time its value is checked, then the call returns -1 with errno  set  to
       EAGAIN.

       If  the	specified  semaphore  referred to by sem is a named semaphore,
       then this semaphore must have been opened by the calling	 process  with
       The  calling  process  must have both read and write permissions on the
       semaphore to perform these operations.  The semaphore  will  be	locked
       upon  successful	 return	 and  will  stay locked until it is explicitly
       released by a call to

       To use this function, link in the realtime library by specifying on the
       compiler or linker command line.

EXAMPLES
       The following call to will lock the semaphore sem.

       The following call to will lock the semaphore sem, if it is available.

RETURN VALUE
       A successful call to will return 0 and the calling thread will then own
       a lock on the semaphore.	 Otherwise, the call to will  return  -1  with
       errno set to the appropriate value of the error condition.

       A  successful call to will return 0, if the semaphore was available and
       the calling thread was able to lock the semaphore.  Otherwise, the call
       to  will return -1 with errno set to the appropriate value of the error
       condition.

ERRORS
       and fail and do not perform the requested operation if any of the  fol‐
       lowing conditions are encountered:

	      [EPERM]	     The  calling process does not have the privileges
			     necessary to lock the semaphore.

	      [EAGAIN]	     The semaphore was not available and  hence	 could
			     not be locked by This error condition only occurs
			     in

	      [EINVAL]	     The argument sem does not refer to a valid	 sema‐
			     phore.

	      [EINTR]	     The function was interrupted by a signal

SEE ALSO
       sem_post(2), <semaphore.h>.

STANDARDS CONFORMANCE
								   sem_wait(2)
[top]

List of man pages available for HP-UX

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