Qt 4.8
Macros | Functions
qatomic_sparc.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_ALWAYS_NATIVE
 
#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE
 
#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_ALWAYS_NATIVE
 
#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE
 
#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE
 

Functions

Q_CORE_EXPORT int q_atomic_lock_int (volatile int *addr)
 
Q_CORE_EXPORT int q_atomic_lock_ptr (volatile void *addr)
 
Q_CORE_EXPORT int q_atomic_set_int (volatile int *ptr, int newval)
 
Q_CORE_EXPORT void * q_atomic_set_ptr (volatile void *ptr, void *newval)
 
Q_CORE_EXPORT void q_atomic_unlock (volatile void *addr, int value)
 

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 314 of file qatomic_sparc.h.

◆ Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE

#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE

Definition at line 306 of file qatomic_sparc.h.

◆ Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE

#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE

Definition at line 307 of file qatomic_sparc.h.

◆ Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE

#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE

Definition at line 292 of file qatomic_sparc.h.

◆ Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE

#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE

Definition at line 299 of file qatomic_sparc.h.

◆ Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE

#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE

Definition at line 340 of file qatomic_sparc.h.

◆ Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE

#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE

Definition at line 330 of file qatomic_sparc.h.

◆ Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE

#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE

Definition at line 331 of file qatomic_sparc.h.

◆ Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE

#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE

Definition at line 321 of file qatomic_sparc.h.

Function Documentation

◆ q_atomic_lock_int()

Q_CORE_EXPORT int q_atomic_lock_int ( volatile int *  addr)

Definition at line 52 of file qatomic_sparc.cpp.

53 {
54  int returnValue = q_atomic_trylock_int(addr);
55 
56  if (returnValue == INT_MIN) {
57  do {
58  // spin until we think we can succeed
59  do {
60  sched_yield();
61  returnValue = *addr;
62  } while (returnValue == INT_MIN);
63 
64  // try again
65  returnValue = q_atomic_trylock_int(addr);
66  } while (returnValue == INT_MIN);
67  }
68 
69  return returnValue;
70 }
int q_atomic_trylock_int(volatile int *addr)

◆ q_atomic_lock_ptr()

Q_CORE_EXPORT int q_atomic_lock_ptr ( volatile void *  addr)

Definition at line 72 of file qatomic_sparc.cpp.

73 {
74  int returnValue = q_atomic_trylock_ptr(addr);
75 
76  if (returnValue == -1) {
77  do {
78  // spin until we think we can succeed
79  do {
80  sched_yield();
81  returnValue = *reinterpret_cast<volatile int *>(addr);
82  } while (returnValue == -1);
83 
84  // try again
85  returnValue = q_atomic_trylock_ptr(addr);
86  } while (returnValue == -1);
87  }
88 
89  return returnValue;
90 }
int q_atomic_trylock_ptr(volatile void *addr)

◆ q_atomic_set_int()

Q_CORE_EXPORT int q_atomic_set_int ( volatile int *  ptr,
int  newval 
)

◆ q_atomic_set_ptr()

Q_CORE_EXPORT void* q_atomic_set_ptr ( volatile void *  ptr,
void *  newval 
)

◆ q_atomic_unlock()

Q_CORE_EXPORT void q_atomic_unlock ( volatile void *  addr,
int  value 
)