Changeset 1219
- Timestamp:
- Dec 13, 2015, 11:03:49 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified fontconfig/trunk/src/fcatomic.h ¶
r1218 r1219 112 112 113 113 114 #elif !defined(FC_NO_MT) && defined(__GNUC__) && defined(__OS2__)115 116 extern inline int __my_sync_fetch_and_add (volatile int *ptr, int value);117 extern inline int __my_sync_fetch_and_add (volatile int *ptr, int value)118 {119 asm volatile ("mfence; lock xaddl %%eax, %2;"120 : "=a" (value)121 : "a" (value), "m" (*ptr)122 : "memory");123 return value;124 }125 126 extern inline void __my_sync_synchronize (void);127 extern inline void __my_sync_synchronize (void)128 {129 asm volatile ("mfence" ::: "memory");130 }131 132 extern inline int __my_sync_bool_compare_and_swap (volatile void **ptr, void *oldval, void *newval);133 extern inline int __my_sync_bool_compare_and_swap (volatile void **ptr, void *oldval, void *newval)134 {135 char success;136 asm volatile ("mfence; lock cmpxchgl %3, %2;"137 "sete %1;"138 : "=a" (newval), "=qm" (success), "+m" (*ptr)139 : "r" (newval), "0" (oldval)140 : "memory");141 return success != 0;142 }143 144 typedef int fc_atomic_int_t;145 #define fc_atomic_int_add(AI, V) __my_sync_fetch_and_add (&(AI), (V))146 147 #define fc_atomic_ptr_get(P) (void *) (__my_sync_synchronize (), *(P))148 #define fc_atomic_ptr_cmpexch(P,O,N) __my_sync_bool_compare_and_swap ((volatile void **)(P), (void *)(O), (void *)(N))149 150 151 114 #elif !defined(FC_NO_MT) 152 115
Note:
See TracChangeset
for help on using the changeset viewer.