C:/rwlock/atomic_util_w32.h File Reference

Go to the source code of this file.

Defines

#define _ATOMIC_UTIL_USE_ASM_
#define _ATOMIC_UTIL_SMP_
#define CPU_LOCK   lock
#define atomic_cmpexch   atomic_cmpexch_return

Functions

void atomic_inc (volatile int *vptr)
void atomic_dec (volatile int *vptr)
void atomic_add (volatile int *vptr, const int additive)
void atomic_and (volatile int *vptr, const int param)
int atomic_inc_return (volatile int *vptr)
int atomic_dec_return (volatile int *vptr)
int atomic_add_return (volatile int *vptr, const int additive)
int atomic_cmpexch_return (volatile int *vptr, const int new_val, const int comparand)
short atomic_cmpexch_return_w (volatile short *vptr, const short new_val, const short comparand)


Define Documentation

#define _ATOMIC_UTIL_SMP_

Definition at line 8 of file atomic_util_w32.h.

#define _ATOMIC_UTIL_USE_ASM_

Definition at line 5 of file atomic_util_w32.h.

#define atomic_cmpexch   atomic_cmpexch_return

Definition at line 112 of file atomic_util_w32.h.

#define CPU_LOCK   lock

Definition at line 10 of file atomic_util_w32.h.


Function Documentation

void atomic_add ( volatile int *  vptr,
const int  additive 
) [inline]

Definition at line 44 of file atomic_util_w32.h.

00045 {
00046         __asm 
00047         { 
00048                         mov eax, vptr
00049                         mov ebx, additive
00050                         lock add [eax], ebx
00051         }
00052 }

int atomic_add_return ( volatile int *  vptr,
const int  additive 
) [inline]

Definition at line 82 of file atomic_util_w32.h.

00083 {
00084         __asm 
00085         { 
00086                         mov ebx, vptr
00087                         mov eax, additive
00088                         lock xadd [ebx], eax
00089         }
00090 }

void atomic_and ( volatile int *  vptr,
const int  param 
) [inline]

Definition at line 53 of file atomic_util_w32.h.

00054 {
00055         __asm 
00056         { 
00057                         mov eax, vptr
00058                         mov ebx, param
00059                         lock and [eax], ebx
00060         }
00061 }

int atomic_cmpexch_return ( volatile int *  vptr,
const int  new_val,
const int  comparand 
) [inline]

Definition at line 91 of file atomic_util_w32.h.

00092 {
00093         __asm 
00094         { 
00095                         mov eax, comparand
00096                         mov ebx, new_val
00097                         mov ecx, vptr
00098                         lock cmpxchg [ecx], ebx
00099         }
00100 }

short atomic_cmpexch_return_w ( volatile short *  vptr,
const short  new_val,
const short  comparand 
) [inline]

Definition at line 101 of file atomic_util_w32.h.

Referenced by EvgRWLock2::enter_write().

00102 {
00103         __asm 
00104         { 
00105                         mov ax, comparand
00106                         mov bx, new_val
00107                         mov ecx, vptr
00108                         lock cmpxchg [ecx], bx
00109         }
00110 }

void atomic_dec ( volatile int *  vptr  )  [inline]

Definition at line 36 of file atomic_util_w32.h.

00037 {
00038         __asm 
00039         { 
00040                         mov eax, vptr
00041                         lock dec [eax]
00042         }
00043 }                                                       

int atomic_dec_return ( volatile int *  vptr  )  [inline]

Definition at line 72 of file atomic_util_w32.h.

00073 {
00074         __asm 
00075         { 
00076                         mov ebx, vptr
00077                         mov eax, -1
00078                         lock xadd [ebx], eax
00079                         dec eax
00080         }
00081 }

void atomic_inc ( volatile int *  vptr  )  [inline]

Definition at line 28 of file atomic_util_w32.h.

00029 {
00030         __asm 
00031         { 
00032                         mov eax, vptr
00033                         lock inc [eax]
00034         }
00035 }

int atomic_inc_return ( volatile int *  vptr  )  [inline]

Definition at line 62 of file atomic_util_w32.h.

00063 {
00064         __asm 
00065         { 
00066                         mov ebx, vptr
00067                         mov eax, 1
00068                         lock xadd [ebx], eax
00069                         inc eax
00070         }
00071 }


Generated on Wed Mar 19 14:59:59 2008 for rwlock by  doxygen 1.5.5