diff --git a/gc.c b/gc.c index b3199bab..fa3ca57b 100644 --- a/gc.c +++ b/gc.c @@ -634,7 +634,9 @@ void gc_handshake(gc_status_type s) void gc_post_handshake(gc_status_type s) { + int status = ATOMIC_GET(&gc_status_col); TODO: use atomic to change value of gc_status_col + while (!ATOMIC_SET_IF_EQ(&gc_status_col, status, s)){} } void gc_wait_handshake() diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 330fb5d0..a4b35417 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -405,6 +405,6 @@ typedef union { #define ATOMIC_INC(ptr) __sync_fetch_and_add((ptr),1) #define ATOMIC_DEC(ptr) __sync_fetch_and_sub((ptr),1) #define ATOMIC_GET(ptr) __sync_fetch_and_add((ptr),0) -#define ATOMIC_SET_IF_EQ(ptr, oldv, newv) __sync_val_compare_and_swap(ptr, oldv, newv) +#define ATOMIC_SET_IF_EQ(ptr, oldv, newv) __sync_bool_compare_and_swap(ptr, oldv, newv) #endif /* CYCLONE_TYPES_H */