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

  man pages->IRIX man pages -> sem_init (3c)              
Title
Content
Arch
Section
 

Contents


sem_init(3C)							  sem_init(3C)


NAME    [Toc]    [Back]

     sem_init -	initialize a posix unnamed semaphore

SYNOPSIS    [Toc]    [Back]

     #include <semaphore.h>

     int sem_init(sem_t	*sem<b>, int pshared<b>, unsigned int	value<b>);

DESCRIPTION    [Toc]    [Back]

     sem_init initializes the unnamed semaphore	located	at address sem.	 The
     address sem may reside anywhere in	the calling processes address space,
     but if the	semaphore is intended to be shared across process boundaries,
     sem must reside in	shared memory.

     The pshared argument is used to specify whether the semaphore is intended
     to	be shared across process boundaries or only used locally by threads of
     execution within a	common process.	 If pshared is set to zero, then the
     semaphore is not intended for sharing across process boundaries.
     Conversely, a non-zero pshared value indicates any	process	having read
     and write access to address sem, may perform semaphore operations on sem.
     Unnamed semaphores	have been optimized for	local thread usage, delivering
     increased performance within posix	thread applications [see
     pthread_create(3P)].

     The initial value of the semaphore	is specified by	value, which may be
     any non-negative number less than {SEM_VALUE_MAX} [see sysconf(3C)].

     POSIX semaphores are compatible across all	MIPS ABIs: o32,	n32 and	64.

     Once a semaphore is initialized, processes	may execute the	following
     semaphore operations: sem_post, sem_wait, sem_trywait, sem_getvalue,
     sem_destroy.

     sem_init will fail	if one or more of the following	are true:

     [EINVAL]	 The value parameter was set to	a number greater than
		 {SEM_VALUE_MAX}.

     [ENOSPC]	 The resources required	to initialize the semaphore have been
		 depleted.

     [EPERM]	 The calling process lacks the permissions required to
		 initialize the	semaphore.

SEE ALSO    [Toc]    [Back]

      
      
     sem_destroy(3C), sem_getvalue(3C),	sem_post(3C), sem_wait(3C),
     sem_trywait(3C), sem_open(3C), sem_close(3C), sem_unlink(3C),
     shm_open(3C), sysconf(3C),	mmap(3C)







									Page 1






sem_init(3C)							  sem_init(3C)



DIAGNOSTICS
     Upon successful completion, a value of 0 is returned to the calling
     process. Otherwise, a value of -1 is returned and errno is	set to
     indicate the error.


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
sem_init HP-UX initialize an unnamed POSIX semaphore
sem_destroy HP-UX destroy an unnamed POSIX semaphore
sem_destroy IRIX deinitialize a posix unnamed semaphore
sem_getvalue IRIX get the value of a posix named or unnamed semaphore
sem_mode IRIX set the operation mode of a POSIX unnamed semaphore
sem_post IRIX release a posix named or unnamed semaphore
sem_wait IRIX acquire a posix named or unnamed semaphore
sem_init FreeBSD initialize an unnamed semaphore
sem_init OpenBSD initialize an unnamed semaphore
pipcrm HP-UX remove a POSIX message queue or a POSIX named semaphore
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service