mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 07:17:37 +02:00
WIP
This commit is contained in:
parent
23cf9bd14c
commit
af3aa141f1
2 changed files with 3 additions and 1 deletions
2
gc.c
2
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()
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue