unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

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



 sem_destroy(2)						      sem_destroy(2)




 NAME
      sem_destroy - destroy an unnamed POSIX semaphore

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

      int sem_destroy(sem_t *sem);

 DESCRIPTION
      sem_destroy() is used to destroy an unnamed semaphore.  A successful
      call to sem_destroy() will invalidate the unnamed semaphore referred
      to by sem and removes all descriptors referencing it.  The semaphore
      should have been created by a previous call to sem_init() and there
      should not be any processes blocked on it.

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

 EXAMPLES
      The following call to sem_destroy() will destroy an unnamed semaphore
      referred to by sem and remove all descriptors referencing it.

	   sem_destroy(sem);

 RETURN VALUE
      If the semaphore was destroyed and the descriptors referencing it were
      removed, sem_destroy() returns 0 to the caller.

      If the semaphore could not be destroyed, the call returns -1 and sets
      errno to indicate the error.

 ERRORS
      sem_destroy() fails and does not perform the requested operation if
      any of the following conditions are encountered:

	   [EBUSY]	  There are threads currently blocked on the
			  semaphore or there are outstanding locks held on
			  the semaphore.

	   [EINVAL]	  The argument sem is not a valid unnamed semaphore.

 SEE ALSO
      sem_init(2), sem_open(2), <semaphore.h>.

 STANDARDS CONFORMANCE
      sem_destroy(): POSIX








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