unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (HP-UX-11.11)
Page:
Section:
Apropos / Subsearch:
optional field



 msem_unlock(2)						      msem_unlock(2)




 NAME
      msem_unlock - unlock a semaphore

 SYNOPSIS
      #include <&lt&lt&lt;sys/mman.h>&gt&gt&gt;

      int msem_unlock(msemaphore *sem, int condition);

 DESCRIPTION
      msem_unlock() unlocks a binary semaphore.

      sem points to an msemaphore structure that specifies the semaphore to
      be unlocked.

      If the condition argument is zero, the semaphore will be unlocked,
      whether or not any other processes are currently attempting to lock
      it.  If the condition argument is MSEM_IF_WAITERS, and some other
      process is waiting to lock the semaphore or the implementation cannot
      reliably determine whether some process is waiting to lock the
      semaphore, the semaphore is unlocked by the calling process.  If the
      condition argument is MSEM_IF_WAITERS, and no process is waiting to
      lock the semaphore, the semaphore is not unlocked and an error is
      returned.

      All calls to msem_lock() and msem_unlock() by multiple processes
      sharing a common msemaphore structure behave as if the calls were
      serialized.

      If the msemaphore structure contains any value not resulting from a
      call to msem_init() followed by a (possibly empty) sequence of calls
      to msem_lock() and msem_unlock(), the results are undefined.  The
      address of an msemaphore uniquely identifies the semaphore.  If the
      msemaphore structure contains any value copied from a msemaphore
      structure at a different address, the result is undefined.

 IMPLEMENTATION NOTES
      The system attempts to ignore or recover from invalid values placed in
      the msemaphore structure, but this is not guaranteed for all cases.

 RETURN VALUE
      Upon success, msem_unlock() returns zero; otherwise, it returns -1 and
      sets errno to indicate the error.

 ERRORS
      msem_unlock() fails if any of the following conditions are
      encountered:

	   [EAGAIN]	  MSEM_IF_NOWAIT was specified and there were no
			  waiters.





 Hewlett-Packard Company	    - 1 -   HP-UX Release 11i: November 2000






 msem_unlock(2)						      msem_unlock(2)




	   [EINVAL]	  sem points to an msemaphore structure that has
			  been removed, or condition is invalid.

	   [EFAULT]	  sem is an invalid pointer.

 AUTHOR
      msem_unlock() was developed by HP and OSF.

 SEE ALSO
      msem_init(2), msem_lock(2), msem_remove(2), mman(5).

 STANDARDS CONFORMANCE
      msem_unlock(): AES









































 Hewlett-Packard Company	    - 2 -   HP-UX Release 11i: November 2000