fix SCM_CELL_* macro usage in async.c
[bpt/guile.git] / libguile / async.c
index 3e5a581..ddb2a21 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2006, 2008, 2009 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
@@ -22,6 +22,8 @@
 #  include <config.h>
 #endif
 
+#define SCM_BUILDING_DEPRECATED_CODE
+
 #include <signal.h>
 #include "libguile/_scm.h"
 #include "libguile/eval.h"
@@ -85,9 +87,9 @@ static scm_t_bits tc16_async;
 #define SCM_ASYNCP(X)          SCM_TYP16_PREDICATE (tc16_async, X)
 #define VALIDATE_ASYNC(pos, a) SCM_MAKE_VALIDATE_MSG(pos, a, ASYNCP, "user async")
 
-#define ASYNC_GOT_IT(X)        (SCM_CELL_WORD_0 (X) >> 16)
-#define SET_ASYNC_GOT_IT(X, V) (SCM_SET_CELL_WORD_0 ((X), SCM_TYP16 (X) | ((V) << 16)))
-#define ASYNC_THUNK(X)         SCM_CELL_OBJECT_1 (X)
+#define ASYNC_GOT_IT(X)        (SCM_SMOB_FLAGS (X))
+#define SET_ASYNC_GOT_IT(X, V) (SCM_SET_SMOB_FLAGS ((X), ((V))))
+#define ASYNC_THUNK(X)         SCM_SMOB_OBJECT_1 (X)
 
 
 SCM_DEFINE (scm_async, "async", 1, 0, 0,
@@ -470,13 +472,35 @@ scm_dynwind_unblock_asyncs ()
   scm_dynwind_unwind_handler (increase_block, t, SCM_F_WIND_EXPLICITLY);
 }
 
+\f
+/* These are function variants of the same-named macros (uppercase) for use
+   outside of libguile.  This is so that `SCM_I_CURRENT_THREAD', which may
+   reside in TLS, is not accessed from outside of libguile.  It thus allows
+   libguile to be built with the "local-dynamic" TLS model.  */
+
+void
+scm_critical_section_start (void)
+{
+  SCM_CRITICAL_SECTION_START;
+}
+
+void
+scm_critical_section_end (void)
+{
+  SCM_CRITICAL_SECTION_END;
+}
+
+void
+scm_async_tick (void)
+{
+  SCM_ASYNC_TICK;
+}
 
 \f
 
 void
 scm_init_async ()
 {
-  scm_asyncs = SCM_EOL;
   tc16_async = scm_make_smob_type ("async", 0);
 
 #include "libguile/async.x"