mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
* __scm.h (SCM_ASYNC_TICK): Removed thread switching code.
(SCM_ALLOW_INTS): Added thread switching code before interrupts get re-enabled. The important effect of this is that interrupts are blocked during thread switching so that thread data structures don't risk getting messed up by an unfortunate signal. (SCM_REDEFER_INTS, SCM_REALLOW_INTS): It turned out that gcc-2.8.0 seems to do more aggressive optimization which actually move instructions around in these macros in a fatal way. Therefore: Introduce Anthony's SCM_FENCE macro! (And I who thought he was just superstitious...) (SCM_TICK): Maybe do a context switch and take care of asyncs. This macro should be used instead of SCM_ASYNC_TICK since the latter doesn't do context switches any more.
This commit is contained in:
parent
13dc0cae2f
commit
c72cc5fbe4
1 changed files with 14 additions and 11 deletions
|
@ -252,23 +252,13 @@ typedef long SCM_STACKITEM;
|
|||
#endif
|
||||
|
||||
extern unsigned int scm_async_clock;
|
||||
#if 0
|
||||
|
||||
#define SCM_ASYNC_TICK \
|
||||
{ \
|
||||
if (0 == --scm_async_clock) \
|
||||
scm_async_click (); \
|
||||
} \
|
||||
|
||||
#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 \
|
||||
if (scm_ints_disabled) \
|
||||
|
@ -326,6 +316,8 @@ extern unsigned int scm_async_clock;
|
|||
{ \
|
||||
SCM_FENCE; \
|
||||
SCM_CHECK_NOT_ENABLED; \
|
||||
SCM_THREAD_SWITCHING_CODE; \
|
||||
SCM_FENCE; \
|
||||
scm_ints_disabled = 0; \
|
||||
SCM_FENCE; \
|
||||
SCM_THREAD_ALLOW; \
|
||||
|
@ -336,23 +328,34 @@ extern unsigned int scm_async_clock;
|
|||
|
||||
#define SCM_REDEFER_INTS \
|
||||
{ \
|
||||
SCM_FENCE; \
|
||||
SCM_THREAD_REDEFER; \
|
||||
++scm_ints_disabled; \
|
||||
SCM_FENCE; \
|
||||
} \
|
||||
|
||||
|
||||
#define SCM_REALLOW_INTS \
|
||||
{ \
|
||||
SCM_FENCE; \
|
||||
SCM_THREAD_REALLOW_1; \
|
||||
SCM_THREAD_SWITCHING_CODE; \
|
||||
SCM_FENCE; \
|
||||
--scm_ints_disabled; \
|
||||
if (!scm_ints_disabled) \
|
||||
{ \
|
||||
SCM_THREAD_REALLOW_2; \
|
||||
SCM_ASYNC_TICK; \
|
||||
} \
|
||||
SCM_FENCE; \
|
||||
} \
|
||||
|
||||
|
||||
#define SCM_TICK \
|
||||
{ \
|
||||
SCM_DEFER_INTS; \
|
||||
SCM_ALLOW_INTS; \
|
||||
} \
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue