*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> sem_close (2)              
Title
Content
Arch
Section
 

Contents


 sem_close(2)                                                   sem_close(2)




 NAME    [Toc]    [Back]
      sem_close - close a named POSIX semaphore

 SYNOPSIS    [Toc]    [Back]
      #include <sys/semaphore.h>

      int sem_close(sem_t *sem);

 DESCRIPTION    [Toc]    [Back]
      sem_close() is used to close a named semaphore.  A successful call to
      sem_close() will do the following: Remove the process's descriptor for
      the semaphore referenced by the specified sem_t structure sem.  Remove
      the semaphore referenced by the specified sem_t structure sem, if the
      semaphore is marked for removal by a call to sem_unlink() and there
      are no other descriptors referencing this semaphore.

      When the process's descriptor for the semaphore referenced by sem is
      removed, subsequent use of this semaphore by this process will fail.
      Descriptors for named semaphores are also removed by processes on
      exit.  Calling sem_close() does not affect other processes referencing
      the same semaphore.

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

 EXAMPLES    [Toc]    [Back]
      The following call to sem_close() will close a named semaphore
      referred to by sem by removing the process's descriptor to the
      semaphore and removing the semaphore if it is marked for removal by a
      previous sem_unlink() and there are no descriptors referencing it.

           sem_close(sem);

 RETURN VALUE    [Toc]    [Back]
      If the semaphore was closed and the descriptors referencing it were
      removed, sem_close() returns 0 to the caller.

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

 ERRORS    [Toc]    [Back]
      sem_close() fails and does not perform the requested operation if the
      following condition is encountered:

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

 SEE ALSO    [Toc]    [Back]
      sem_init(2), sem_open(2), sem_unlink(2), <semaphore.h>.

 STANDARDS CONFORMANCE    [Toc]    [Back]
      sem_close(): POSIX


 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
sem_close IRIX close a posix named semaphore
pipcrm HP-UX remove a POSIX message queue or a POSIX named semaphore
sem_getvalue IRIX get the value of a posix named or unnamed semaphore
sem_open IRIX open a posix named semaphore
sem_unlink IRIX deletes a posix named semaphore
sem_unlink HP-UX unlink a named POSIX semaphore
sem_open HP-UX create/open a named POSIX semaphore
sem_wait IRIX acquire a posix named or unnamed semaphore
sem_post IRIX release a posix named or unnamed semaphore
sem_getvalue HP-UX get the value of a POSIX semaphore
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service