Skip to content

Commit fbee402

Browse files
committed
Fix __atomic_ versions
1 parent 6248424 commit fbee402

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Zend/zend_atomic.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,19 @@ inline ZEND_API void zend_atomic_bool_store(zend_atomic_bool *obj, bool desired)
9898
#define ZEND_ATOMIC_BOOL_INIT(obj, desired) ((obj)->value = (desired))
9999

100100
inline ZEND_API bool zend_atomic_bool_exchange(zend_atomic_bool *obj, bool desired) {
101-
return __atomic_exchange(&obj->value, desired, __ATOMIC_SEQ_CST);
101+
bool prev = false;
102+
__atomic_exchange(&obj->value, &desired, &prev, __ATOMIC_SEQ_CST);
103+
return prev;
102104
}
103105

104106
inline ZEND_API bool zend_atomic_bool_load(const zend_atomic_bool *obj) {
105-
return __atomic_load(&obj->value, __ATOMIC_SEQ_CST);
107+
bool prev = false;
108+
__atomic_load(&obj->value, &prev, __ATOMIC_SEQ_CST);
109+
return prev;
106110
}
107111

108112
inline ZEND_API void zend_atomic_bool_store(zend_atomic_bool *obj, bool desired) {
109-
__atomic_store(&obj->value, desired, __ATOMIC_SEQ_CST);
113+
__atomic_store(&obj->value, &desired, __ATOMIC_SEQ_CST);
110114
}
111115

112116
#elif HAVE_SYNC_ATOMICS

0 commit comments

Comments
 (0)