ReactOS 0.4.16-dev-297-gc569aee
atomic.h File Reference
#include <linux/types.h>
Include dependency graph for atomic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  atomic_t
 

Macros

#define ATOMIC_INIT(i)   (i)
 
#define atomic_read(v)   ((v)->counter)
 
#define atomic_set(v, i)   InterlockedExchange((PLONG)(&(v)->counter), (LONG)(i))
 

Functions

static void atomic_add (int volatile i, atomic_t volatile *v)
 
static void atomic_sub (int volatile i, atomic_t volatile *v)
 
static int atomic_sub_and_test (int volatile i, atomic_t volatile *v)
 
static void atomic_inc (atomic_t volatile *v)
 
static void atomic_dec (atomic_t volatile *v)
 
static int atomic_dec_and_test (atomic_t volatile *v)
 
static int atomic_inc_and_test (atomic_t volatile *v)
 
static int atomic_add_negative (int volatile i, atomic_t volatile *v)
 

Macro Definition Documentation

◆ ATOMIC_INIT

#define ATOMIC_INIT (   i)    (i)

Definition at line 14 of file atomic.h.

◆ atomic_read

#define atomic_read (   v)    ((v)->counter)

atomic_read - read atomic variable @v: pointer of type atomic_t

Atomically reads the value of @v. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 23 of file atomic.h.

◆ atomic_set

#define atomic_set (   v,
  i 
)    InterlockedExchange((PLONG)(&(v)->counter), (LONG)(i))

atomic_set - set atomic variable @v: pointer of type atomic_t @i: required value

Atomically sets the value of @v to @i. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 33 of file atomic.h.

Function Documentation

◆ atomic_add()

static void atomic_add ( int volatile  i,
atomic_t volatile v 
)
inlinestatic

atomic_add - add integer to atomic variable @i: integer value to add @v: pointer of type atomic_t

Atomically adds @i to @v. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 43 of file atomic.h.

44{
45 InterlockedExchangeAdd((PLONG)(&v->counter), (LONG) i);
46}
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define InterlockedExchangeAdd
Definition: interlocked.h:181
long LONG
Definition: pedump.c:60
int32_t * PLONG
Definition: typedefs.h:58

Referenced by __xmlGlobalInitMutexLock().

◆ atomic_add_negative()

static int atomic_add_negative ( int volatile  i,
atomic_t volatile v 
)
inlinestatic

atomic_add_negative - add and test if negative @v: pointer of type atomic_t @i: integer value to add

Atomically adds @i to @v and returns true if the result is negative, or false when result is greater than or equal to zero. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 150 of file atomic.h.

151{
152 return (InterlockedExchangeAdd((PLONG)(&v->counter), (LONG) i) + i);
153}

◆ atomic_dec()

static void atomic_dec ( atomic_t volatile v)
inlinestatic

atomic_dec - decrement atomic variable @v: pointer of type atomic_t

Atomically decrements @v by 1. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 107 of file atomic.h.

108{
109 InterlockedDecrement((PLONG)(&v->counter));
110}
#define InterlockedDecrement
Definition: armddk.h:52

Referenced by free_buffer_head(), journal_free_journal_head(), and kmem_cache_free().

◆ atomic_dec_and_test()

static int atomic_dec_and_test ( atomic_t volatile v)
inlinestatic

atomic_dec_and_test - decrement and test @v: pointer of type atomic_t

Atomically decrements @v by 1 and returns true if the result is 0, or false for all other cases. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 121 of file atomic.h.

122{
123 return (0 == InterlockedDecrement((PLONG)(&v->counter)));
124}

Referenced by __brelse(), iput(), kfree_skb(), kfree_skb_fast(), and tcp_tw_put().

◆ atomic_inc()

static void atomic_inc ( atomic_t volatile v)
inlinestatic

atomic_inc - increment atomic variable @v: pointer of type atomic_t

Atomically increments @v by 1. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 95 of file atomic.h.

96{
97 InterlockedIncrement((PLONG)(&v->counter));
98}
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by ext4_get_group_desc(), get_bh(), iget(), journal_alloc_journal_head(), kmem_cache_alloc(), new_buffer_head(), and skb_get().

◆ atomic_inc_and_test()

static int atomic_inc_and_test ( atomic_t volatile v)
inlinestatic

atomic_inc_and_test - increment and test @v: pointer of type atomic_t

Atomically increments @v by 1 and returns true if the result is zero, or false for all other cases. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 135 of file atomic.h.

136{
137 return (0 == InterlockedIncrement((PLONG)(&v->counter)));
138}

◆ atomic_sub()

static void atomic_sub ( int volatile  i,
atomic_t volatile v 
)
inlinestatic

atomic_sub - subtract the atomic variable @i: integer value to subtract @v: pointer of type atomic_t

Atomically subtracts @i from @v. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 56 of file atomic.h.

57{
58 InterlockedExchangeAdd((PLONG)(&v->counter), (LONG) (-1*i));
59}

◆ atomic_sub_and_test()

static int atomic_sub_and_test ( int volatile  i,
atomic_t volatile v 
)
inlinestatic

atomic_sub_and_test - subtract value from variable and test result @i: integer value to subtract @v: pointer of type atomic_t

Atomically subtracts @i from @v and returns true if the result is zero, or false for all other cases. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 71 of file atomic.h.

72{
73 int counter, result;
74
75 do {
76
77 counter = v->counter;
78 result = counter - i;
79
81 (PLONG) (&v->counter),
82 (LONG) result,
83 (LONG) counter) != counter);
84
85 return (result == 0);
86}
GLuint64EXT * result
Definition: glext.h:11304
#define InterlockedCompareExchange
Definition: interlocked.h:104