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

  man pages->IRIX man pages -> pthread_mutexattr_setprotocol (3p)              
Title
Content
Arch
Section
 

Contents


pthread_mutexattr_setprotocol(3P)	     pthread_mutexattr_setprotocol(3P)


NAME    [Toc]    [Back]

     pthread_mutexattr_setprotocol, pthread_mutexattr_getprotocol,
     pthread_mutexattr_setprioceiling, pthread_mutexattr_getprioceiling	-
     set/get a mutex attribute object's	priority and protocol

C SYNOPSIS    [Toc]    [Back]

     #include <pthread.h>

     int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
	  int protocol);

     int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
	  int *oprotocol);

     int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr,
	  int prioceiling);

     int pthread_mutexattr_getprioceiling(const	pthread_mutexattr_t *attr,
	  int *oprioceiling);

DESCRIPTION    [Toc]    [Back]

     These functions manipulate	a mutex	attribute object referenced by attr
     which has been previously created by pthread_mutexattr_init().

     The function pthread_mutexattr_setprotocol() defines the thread priority
     protocol to be followed when acquiring and	holding	mutexes.  The protocol
     value may be one of PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or
     PTHREAD_PRIO_PROTECT.  The	function pthread_mutexattr_getprotocol()
     stores into the memory referenced by oprotocol the	thread priority
     protocol associated with the named	mutex attribute	object.	 The default
     protocol is PTHREAD_PRIO_NONE.

     When a thread owns	a mutex	with the PTHREAD_PRIO_NONE protocol attribute,
     the thread's priority and scheduling are not affected by its mutex
     ownership.

     When a thread owns	one or more mutexes that have been initialized with
     the PTHREAD_PRIO_PROTECT or PTHREAD_PRIO_INHERIT protocol,	it will
     execute at	the higher of its current priority or the highest priority
     associated	with any owned mutex.

     For mutexes initialized with the PTHREAD_PRIO_INHERIT protocol, the
     priority associated with the owned	mutex is the highest priority of any
     thread waiting to acquire the mutex.  (Note that if the thread that owns
     a mutex with the PTHREAD_PRIO_INHERIT protocol becomes blocked on another
     mutex with	the PTHREAD_PRIO_INHERIT, protocol, priority inheritance will
     be	propagated to the owning thread	of this	other mutex.)

     For mutexes initialized with the PTHREAD_PRIO_PROTECT protocol, the
     priority associated with the mutex	is set either by calls to
     pthread_mutex_setprioceiling() or by call to
     pthread_mutexattr_setprioceiling()	on the mutex attribute object that was



									Page 1






pthread_mutexattr_setprotocol(3P)	     pthread_mutexattr_setprotocol(3P)



     used to initialized the mutex.  For pthread_mutexattr_setprioceiling(),
     the values	of prioceiling must be within the values returned by
     sched_get_priority_min() and sched_get_priority_max() for the SCHED_FIFO
     policy.  The function pthread_mutexattr_getprioceiling() stores into the
     memory referenced by oprioceiling the priority associated with the	named
     mutex attribute object; the default priority is the return	value from
     sched_get_priority_min().	Note that a call to pthread_mutex_lock() will
     fail if the mutex protocol	attribute is PTHREAD_PRIO_PROTECT and the
     priority associated with the mutex	is less	than the calling thread's
     priority.

NOTES    [Toc]    [Back]

     Priority inheritance is not supported for process-shared mutexes; all
     other protocols are supported, including priority ceiling.	 Neither
     priority inheritance nor priority ceiling is supported for
     PTHREAD_MUTEX_SPINBLOCK_NP	type mutexes.

DIAGNOSTICS    [Toc]    [Back]

     All of the	mutex attribute	protocol functions return zero on success;
     otherwise,	an error number	is returned:

     [EINVAL]	    The	value specified	by protocol or prioceiling is invalid.

     [EINVAL]	    The	value specified	by protocol is PTHREAD_PRIO_INHERIT
		    and	the process-shared attribute is	set to
		    PTHREAD_PROCESS_SHARED.

     [EINVAL]	    The	routine	has been called	for a mutex of type
		    PTHREAD_MUTEX_SPINBLOCK_NP.

SEE ALSO    [Toc]    [Back]

      
      
     pthread_mutex_lock(3P), pthread_mutex_setprioceiling(3P),
     pthread_mutexattr_settype(3P), pthread_mutexattr_init(3P),
     sched_get_priority_min(3C), sched_get_priority_max(3C).


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
pthread_mutexattr_gettype Tru64 Obtains the mutex type attribute in the specified mutex attributes object
pthread_mutexattr_init IRIX initialize/destroy a mutex attribute object
pthread_mutexattr_getpshared Tru64 Obtains the process-shared attribute of a mutex attributes object
pthread_mutexattr_setpshared Tru64 Sets the process-shared attribute of a mutex attributes object
pthread_mutexattr_settype Tru64 Specifies the mutex type attribute that is used when a mutex is created
pthread_mutexattr_settype OpenBSD mutex attribute operations
pthread_mutexattr FreeBSD mutex attribute operations
pthread_mutexattr_getpshared OpenBSD mutex attribute operations
pthread_mutexattr_getprioceiling OpenBSD mutex attribute operations
pthread_mutexattr_destroy OpenBSD mutex attribute operations
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service