|
#ifndef SCM_ATOMIC_H |
|
#define SCM_ATOMIC_H |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "libguile/gc.h" |
|
|
|
|
|
|
|
static inline int |
|
scm_is_atomic_box (SCM obj) |
|
{ |
|
return SCM_HAS_TYP7 (obj, scm_tc7_atomic_box); |
|
} |
|
|
|
static inline SCM* |
|
scm_atomic_box_loc (SCM obj) |
|
{ |
|
return SCM_CELL_OBJECT_LOC (obj, 1); |
|
} |
|
|
|
#define SCM_VALIDATE_ATOMIC_BOX(pos, var) \ |
|
do { \ |
|
SCM_ASSERT_TYPE (scm_is_atomic_box (var), var, pos, FUNC_NAME, \ |
|
"atomic box"); \ |
|
} while (0) |
|
|
|
|
|
|
|
#ifdef BUILDING_LIBGUILE |
|
SCM_INTERNAL SCM scm_make_atomic_box (SCM init); |
|
SCM_INTERNAL SCM scm_atomic_box_p (SCM obj); |
|
SCM_INTERNAL SCM scm_atomic_box_ref (SCM box); |
|
SCM_INTERNAL SCM scm_atomic_box_set_x (SCM box, SCM val); |
|
SCM_INTERNAL SCM scm_atomic_box_swap_x (SCM box, SCM val); |
|
SCM_INTERNAL SCM scm_atomic_box_compare_and_swap_x (SCM box, SCM expected, SCM desired); |
|
SCM_INTERNAL void scm_i_atomic_box_print (SCM box, SCM port, scm_print_state *pstate); |
|
|
|
SCM_INTERNAL void scm_register_atomic (void); |
|
#endif |
|
|
|
#endif |
|
|