SEM_INIT(3) | Linux Programmer's Manual | SEM_INIT(3) |
NAME
sem_init - initialize an unnamed semaphoreSYNOPSIS
#include<semaphore.h>
int sem_init(sem_t * sem , int pshared , unsigned int value );
DESCRIPTION
sem_init() initializes the unnamed semaphore at the address pointed to by sem. The value argument specifies the initial value for the semaphore.RETURN VALUE
sem_init() returns 0 on success; on error, -1 is returned, and errno is set to indicate the error.ERRORS
- EINVAL
- value exceeds SEM_VALUE_MAX.
- ENOSYS
- pshared is nonzero, but the system does not support process-shared semaphores (see sem_overview(7)).
CONFORMING TO
POSIX.1-2001.NOTES
Bizarrely, POSIX.1-2001 does not specify the value that should be returned by a successful call to sem_init(). POSIX.1-2008 rectifies this, specifying the zero return on success.SEE ALSO
sem_destroy(3), sem_post(3), sem_wait(3), sem_overview(7)COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.2012-05-13 | Linux |