summaryrefslogtreecommitdiff
path: root/libguile/atomic.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/atomic.c')
-rw-r--r--libguile/atomic.c69
1 files changed, 32 insertions, 37 deletions
diff --git a/libguile/atomic.c b/libguile/atomic.c
index 180622b47..adb2a0c4b 100644
--- a/libguile/atomic.c
+++ b/libguile/atomic.c
@@ -1,34 +1,41 @@
-/* Copyright (C) 2016, 2018 Free Software Foundation, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
+/* Copyright 2016,2018-2019
+ Free Software Foundation, Inc.
+
+ This file is part of Guile.
+
+ Guile is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Guile is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with Guile. If not, see
+ <https://www.gnu.org/licenses/>. */
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include "libguile/_scm.h"
-#include "libguile/ports.h"
-#include "libguile/validate.h"
-#include "libguile/atomics-internal.h"
-#include "libguile/atomic.h"
+#include "atomics-internal.h"
+#include "boolean.h"
+#include "extensions.h"
+#include "gsubr.h"
+#include "ports.h"
+#include "version.h"
+
+#include "atomic.h"
+
+
SCM_DEFINE (scm_make_atomic_box, "make-atomic-box", 1, 0, 0,
(SCM init),
"Return an atomic box initialized to value @var{init}.")
@@ -95,21 +102,9 @@ SCM_DEFINE (scm_atomic_box_compare_and_swap_x,
"if the return value is @code{eq?} to @var{expected}.")
#define FUNC_NAME s_scm_atomic_box_compare_and_swap_x
{
- SCM result = expected;
-
SCM_VALIDATE_ATOMIC_BOX (1, box);
- while (!scm_atomic_compare_and_swap_scm (scm_atomic_box_loc (box),
- &result, desired)
- && scm_is_eq (result, expected))
- {
- /* 'scm_atomic_compare_and_swap_scm' has spuriously failed,
- i.e. it has returned 0 to indicate failure, although the
- observed value is 'eq?' to EXPECTED. In this case, we *must*
- try again, because the API of 'atomic-box-compare-and-swap!'
- provides no way to indicate to the caller that the exchange
- failed when the observed value is 'eq?' to EXPECTED. */
- }
- return result;
+ return scm_atomic_compare_and_swap_scm (scm_atomic_box_loc (box),
+ expected, desired);
}
#undef FUNC_NAME
@@ -126,7 +121,7 @@ scm_i_atomic_box_print (SCM exp, SCM port, scm_print_state *pstate)
static void
scm_init_atomic (void)
{
-#include "libguile/atomic.x"
+#include "atomic.x"
}
void