File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -94,20 +94,23 @@ POSIX_ATOMIC_ALL_OPS(ptk_u16_t, u16)
9494POSIX_ATOMIC_ALL_OPS (ptk_u32_t , u32 )
9595POSIX_ATOMIC_ALL_OPS (ptk_u64_t , u64 )
9696
97- // Pointer operations
97+
98+ #include <stdint.h>
99+ // Pointer operations using uintptr_t for atomicity
98100void * ptk_atomic_load_ptr (ptk_atomic void * * src_value ) {
99- return atomic_load ((_Atomic void * * )src_value );
101+ uintptr_t val = atomic_load ((_Atomic uintptr_t * )src_value );
102+ return (void * )val ;
100103}
101104
102105ptk_err_t ptk_atomic_store_ptr (ptk_atomic void * * dest_value , void * src_value ) {
103- atomic_store ((_Atomic void * * )dest_value , src_value );
106+ atomic_store ((_Atomic uintptr_t * )dest_value , ( uintptr_t ) src_value );
104107 return PTK_OK ;
105108}
106109
107110void * ptk_atomic_compare_and_swap_ptr (ptk_atomic void * * dest_value , void * old_value , void * new_value ) {
108- void * expected = old_value ;
109- atomic_compare_exchange_strong ((_Atomic void * * )dest_value , & expected , new_value );
110- return expected ;
111+ uintptr_t expected = ( uintptr_t ) old_value ;
112+ atomic_compare_exchange_strong ((_Atomic uintptr_t * )dest_value , & expected , ( uintptr_t ) new_value );
113+ return ( void * ) expected ;
111114}
112115
113116#else
You can’t perform that action at this time.
0 commit comments