diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1996-11-02 20:52:39 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1996-11-02 20:52:39 +0000 |
commit | 25d3ee9d80f045a9fb6d00732f21db97ba5a798a (patch) | |
tree | 9366adf46fdc7ebdb894d256c88c164ba798afae | |
parent | c51bfd813b3b6028c1f8f63f27603183e57fe23a (diff) | |
download | guile-25d3ee9d80f045a9fb6d00732f21db97ba5a798a.tar.gz |
* __scm.h: Added hooks for threads to plugin to in ints protection
macros: SCM_THREAD_DEFER, SCM_THREAD_ALLOW, SCM_THREAD_REDEFER,
SCM_THREAD_ALLOW_1, SCM_THREAD_ALLOW_2. Motivation: We don't want
the main code in these macros duplicated and spread over multiple
files. Renamed SCM_THREADS_SWITCHING_CODE ->
SCM_THREAD_SWITCHING_CODE.
-rw-r--r-- | libguile/__scm.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/libguile/__scm.h b/libguile/__scm.h index 5c6425c3c..22c2eaa38 100644 --- a/libguile/__scm.h +++ b/libguile/__scm.h @@ -243,17 +243,31 @@ typedef long SCM_STACKITEM; #ifndef USE_THREADS -#define SCM_THREADS_SWITCHING_CODE +#define SCM_THREAD_DEFER +#define SCM_THREAD_ALLOW +#define SCM_THREAD_REDEFER +#define SCM_THREAD_REALLOW_1 +#define SCM_THREAD_REALLOW_2 +#define SCM_THREAD_SWITCHING_CODE #endif extern unsigned int scm_async_clock; +#if 0 #define SCM_ASYNC_TICK \ { \ if (0 == --scm_async_clock) \ scm_async_click (); \ - SCM_THREADS_SWITCHING_CODE; \ } \ +#else +#define SCM_ASYNC_TICK \ +{ \ + if (0 == --scm_async_clock) \ + scm_async_click (); \ + SCM_THREAD_SWITCHING_CODE; \ +} \ + +#endif #ifdef SCM_CAREFUL_INTS #define SCM_CHECK_NOT_DISABLED \ @@ -273,12 +287,14 @@ extern unsigned int scm_async_clock; #define SCM_DEFER_INTS \ { \ SCM_CHECK_NOT_DISABLED; \ + SCM_THREAD_DEFER; \ scm_ints_disabled = 1; \ } \ #define SCM_ALLOW_INTS_ONLY \ { \ + SCM_THREAD_ALLOW; \ scm_ints_disabled = 0; \ } \ @@ -286,6 +302,7 @@ extern unsigned int scm_async_clock; #define SCM_ALLOW_INTS \ { \ SCM_CHECK_NOT_ENABLED; \ + SCM_THREAD_ALLOW; \ scm_ints_disabled = 0; \ SCM_ASYNC_TICK; \ } \ @@ -293,15 +310,20 @@ extern unsigned int scm_async_clock; #define SCM_REDEFER_INTS \ { \ + SCM_THREAD_REDEFER; \ ++scm_ints_disabled; \ } \ #define SCM_REALLOW_INTS \ { \ + SCM_THREAD_REALLOW_1; \ --scm_ints_disabled; \ if (!scm_ints_disabled) \ - SCM_ASYNC_TICK; \ + { \ + SCM_THREAD_REALLOW_2; \ + SCM_ASYNC_TICK; \ + } \ } \ |