Qt 4.8
Macros | Functions
qatomic_generic.h File Reference

Go to the source code of this file.

Macros

#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE
 
#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE
 
#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE
 
#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE
 
#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE
 
#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE
 
#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE
 

Functions

Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddOrdered (volatile int *, int)
 
Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreOrdered (volatile int *, int)
 
Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetOrdered (volatile int *, int, int)
 
Q_CORE_EXPORT void * QBasicAtomicPointer_fetchAndAddOrdered (void *volatile *, qptrdiff)
 
Q_CORE_EXPORT void * QBasicAtomicPointer_fetchAndStoreOrdered (void *volatile *, void *)
 
Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered (void *volatile *, void *, void *)
 

Macro Definition Documentation

◆ Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE

#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE

Definition at line 70 of file qatomic_generic.h.

◆ Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE

#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE

Definition at line 63 of file qatomic_generic.h.

◆ Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE

#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE

Definition at line 49 of file qatomic_generic.h.

◆ Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE

#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE

Definition at line 56 of file qatomic_generic.h.

◆ Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE

#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE

Definition at line 95 of file qatomic_generic.h.

◆ Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE

#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE

Definition at line 86 of file qatomic_generic.h.

◆ Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE

#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE

Definition at line 77 of file qatomic_generic.h.

Function Documentation

◆ QBasicAtomicInt_fetchAndAddOrdered()

Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddOrdered ( volatile int *  ,
int   
)

Definition at line 76 of file qatomic_generic_unix.cpp.

77 {
78  int returnValue;
79  pthread_mutex_lock(&qAtomicMutex);
80  returnValue = *_q_value;
81  *_q_value += valueToAdd;
82  pthread_mutex_unlock(&qAtomicMutex);
83  return returnValue;
84 }
static pthread_mutex_t qAtomicMutex

◆ QBasicAtomicInt_fetchAndStoreOrdered()

Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreOrdered ( volatile int *  ,
int   
)

Definition at line 65 of file qatomic_generic_unix.cpp.

66 {
67  int returnValue;
68  pthread_mutex_lock(&qAtomicMutex);
69  returnValue = *_q_value;
70  *_q_value = newValue;
71  pthread_mutex_unlock(&qAtomicMutex);
72  return returnValue;
73 }
static pthread_mutex_t qAtomicMutex

◆ QBasicAtomicInt_testAndSetOrdered()

Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetOrdered ( volatile int *  ,
int  ,
int   
)

Definition at line 52 of file qatomic_generic_unix.cpp.

53 {
54  bool returnValue = false;
55  pthread_mutex_lock(&qAtomicMutex);
56  if (*_q_value == expectedValue) {
57  *_q_value = newValue;
58  returnValue = true;
59  }
60  pthread_mutex_unlock(&qAtomicMutex);
61  return returnValue;
62 }
static pthread_mutex_t qAtomicMutex

◆ QBasicAtomicPointer_fetchAndAddOrdered()

Q_CORE_EXPORT void* QBasicAtomicPointer_fetchAndAddOrdered ( void *volatile *  ,
qptrdiff   
)

Definition at line 113 of file qatomic_generic_unix.cpp.

114 {
115  void *returnValue;
116  pthread_mutex_lock(&qAtomicMutex);
117  returnValue = *_q_value;
118  *_q_value = reinterpret_cast<char *>(returnValue) + valueToAdd;
119  pthread_mutex_unlock(&qAtomicMutex);
120  return returnValue;
121 }
static pthread_mutex_t qAtomicMutex

◆ QBasicAtomicPointer_fetchAndStoreOrdered()

Q_CORE_EXPORT void* QBasicAtomicPointer_fetchAndStoreOrdered ( void *volatile *  ,
void *   
)

Definition at line 102 of file qatomic_generic_unix.cpp.

103 {
104  void *returnValue;
105  pthread_mutex_lock(&qAtomicMutex);
106  returnValue = *_q_value;
107  *_q_value = newValue;
108  pthread_mutex_unlock(&qAtomicMutex);
109  return returnValue;
110 }
static pthread_mutex_t qAtomicMutex

◆ QBasicAtomicPointer_testAndSetOrdered()

Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered ( void *volatile *  ,
void *  ,
void *   
)

Definition at line 87 of file qatomic_generic_unix.cpp.

90 {
91  bool returnValue = false;
92  pthread_mutex_lock(&qAtomicMutex);
93  if (*_q_value == expectedValue) {
94  *_q_value = newValue;
95  returnValue = true;
96  }
97  pthread_mutex_unlock(&qAtomicMutex);
98  return returnValue;
99 }
static pthread_mutex_t qAtomicMutex