atomic.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef SCM_ATOMIC_H
  2. #define SCM_ATOMIC_H
  3. /* Copyright (C) 2016 Free Software Foundation, Inc.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public License
  7. * as published by the Free Software Foundation; either version 3 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. * 02110-1301 USA
  19. */
  20. #include "libguile/__scm.h"
  21. #include "libguile/gc.h"
  22. #include "libguile/tags.h"
  23. static inline int
  24. scm_is_atomic_box (SCM obj)
  25. {
  26. return SCM_HAS_TYP7 (obj, scm_tc7_atomic_box);
  27. }
  28. static inline SCM*
  29. scm_atomic_box_loc (SCM obj)
  30. {
  31. return SCM_CELL_OBJECT_LOC (obj, 1);
  32. }
  33. #ifdef BUILDING_LIBGUILE
  34. SCM_INTERNAL SCM scm_make_atomic_box (SCM init);
  35. SCM_INTERNAL SCM scm_atomic_box_p (SCM obj);
  36. SCM_INTERNAL SCM scm_atomic_box_ref (SCM box);
  37. SCM_INTERNAL SCM scm_atomic_box_set_x (SCM box, SCM val);
  38. SCM_INTERNAL SCM scm_atomic_box_swap_x (SCM box, SCM val);
  39. SCM_INTERNAL SCM scm_atomic_box_compare_and_swap_x (SCM box, SCM expected, SCM desired);
  40. SCM_INTERNAL void scm_i_atomic_box_print (SCM box, SCM port, scm_print_state *pstate);
  41. SCM_INTERNAL void scm_register_atomic (void);
  42. #endif /* BUILDING_LIBGUILE */
  43. #endif /* SCM_ATOMIC_H */