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

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

Contents


TEST_AND_SET(3P)					      TEST_AND_SET(3P)


NAME    [Toc]    [Back]

     test_and_set, test_then_and, test_then_nand, test_then_not,
     test_then_nor, test_then_xor, test_then_or, test_then_add,	add_then_test,
     atomic_op,	is_mips2, _test_and_set	 - mutual exclusion operators

C SYNOPSIS    [Toc]    [Back]

     #include <mutex.h>

     unsigned long test_and_set	(unsigned long *, unsigned long);

     unsigned long test_then_and (unsigned long	*, unsigned long);

     unsigned long test_then_nand (unsigned long *, unsigned long);

     unsigned long test_then_not (unsigned long	*, unsigned long);

     unsigned long test_then_nor (unsigned long	*, unsigned long);

     unsigned long test_then_xor (unsigned long	*, unsigned long);

     unsigned long test_then_or	(unsigned long *, unsigned long);

     unsigned long test_then_add (unsigned long	*, unsigned long);

     unsigned long add_then_test (unsigned long	*, unsigned long);

     unsigned long atomic_op (
		    unsigned long (*)(unsigned long  unsigned long),
		    unsigned long *, unsigned long);

     is_mips2(void);

     int _test_and_set (int *, int);

     -------------------

     #include <sgidefs.h>
     #include <mutex.h>

     __uint32_t	test_and_set32 (__uint32_t *, __uint32_t);

     __uint32_t	test_then_and32	(__uint32_t *, __uint32_t);

     __uint32_t	test_then_nand32 (__uint32_t *,	__uint32_t);

     __uint32_t	test_then_not32	(__uint32_t *, __uint32_t);

     __uint32_t	test_then_nor32	(__uint32_t *, __uint32_t);

     __uint32_t	test_then_xor32	(__uint32_t *, __uint32_t);





									Page 1






TEST_AND_SET(3P)					      TEST_AND_SET(3P)



     __uint32_t	test_then_or32 (__uint32_t *, __uint32_t);

     __uint32_t	test_then_add32	(__uint32_t *, __uint32_t);

     __uint32_t	add_then_test32	(__uint32_t *, __uint32_t);

     __uint32_t	atomic_op32 (
		    __uint32_t (*)(__uint32_t  __uint32_t),
		    __uint32_t *, __uint32_t);

DESCRIPTION    [Toc]    [Back]

     test_and_set atomically reads the unsigned	long pointed to	by the first
     argument and updates the location with the	value specified	in the second
     argument.	The read value is returned.

     test_then_and atomically reads the	unsigned long pointed to by the	first
     argument and updates the location with the	value specified	in the second
     argument bit-wise and'ed with the read value.  The	read value is
     returned.

     test_then_nand atomically reads the unsigned long pointed to by the first
     argument and updates the location with the	value specified	in the second
     argument bit-wise nand'ed with the	read value.  The read value is
     returned.

     test_then_not atomically reads the	unsigned long pointed to by the	first
     argument and updates the location with the	bit-wise inverted version of
     the read value.  The read value is	returned.

     test_then_nor atomically reads the	unsigned long pointed to by the	first
     argument and updates the location with the	value specified	in the second
     argument bit-wise or'ed with the read value then inverted.	 The read
     value is returned.

     test_then_xor atomically reads the	unsigned long pointed to by the	first
     argument and updates the location with the	value specified	in the second
     argument bit-wise xor'ed with the read value.  The	read value is
     returned.

     test_then_or atomically reads the unsigned	long pointed to	by the first
     argument and updates the location with the	value specified	in the second
     argument bit-wise or'ed with the read value.  The read value is returned.

     test_then_add atomically reads the	unsigned long pointed to by the	first
     argument and updates the location with the	value specified	in the second
     argument summed with the read value.  The read value is returned.

     add_then_test atomically reads the	unsigned long pointed to by the	first
     argument and updates the location with the	value specified	in the second
     argument summed with the read value.  The summed value is returned.





									Page 2






TEST_AND_SET(3P)					      TEST_AND_SET(3P)



     atomic_op permits one of the above	functions to be	passed as the first
     argument.	The other two arguments	and return value are the same as those
     of	the specified function.

     is_mips2 returns 1	if the machine on which	it is executed supports	the
     MIPS II instruction set, 0	otherwise.

     _test_and_set atomically reads the	int pointed to by the first argument
     and updates the location with the value specified in the second argument.
     The read value is returned.  This function	is the same as test_and_set
     except for	the type of its	arguments.

     test_and_set32, test_then_and32,  test_then_nand32, test_then_not32,
     test_then_nor32, test_then_xor32, test_then_or32, test_then_add32,
     add_then_test32, and atomic_op32 all work the same	as their non-32
     counterparts, except that the size	of the arguments are 32-bits
     (__uint32_t) regardless of	the size of an unsigned	long.  This
     accommodates shared variables between 64-bit and 32-bit programs.

SEE ALSO    [Toc]    [Back]

      
      
     usinit(3P), abilock(3X).

DIAGNOSTICS    [Toc]    [Back]

     The return	value for these	functions is specified in the above
     description for each function.


									PPPPaaaaggggeeee 3333
[ Back ]
 Similar pages
Name OS Title
abilock IRIX ABI mutual exclusion primitives
pthread_mutex_lock IRIX mutual exclusion locks
perlop IRIX Perl operators and precedence
erff OpenBSD error function operators
erfcf OpenBSD error function operators
erfc OpenBSD error function operators
erf OpenBSD error function operators
perlop OpenBSD Perl operators and precedence
erfcf NetBSD error function operators
erfc NetBSD error function operators
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service