mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
* async.c, __scm.h: Removed lots of the old async click logic. It
is possible to reinsert it by defining GUILE_OLD_ASYNC_CLICK in __scm.h. Let's try this out and dump the old code after the threads reorganization. (set-tick-rate, set-switch-rate): Conditionally removed.
This commit is contained in:
parent
90cca6f9aa
commit
9f0e55a65b
2 changed files with 49 additions and 8 deletions
|
@ -60,6 +60,9 @@
|
||||||
* These may be defined or undefined.
|
* These may be defined or undefined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Old async mechanism */
|
||||||
|
/* #define GUILE_OLD_ASYNC_CLICK */
|
||||||
|
|
||||||
/* New scheme for garbage collection */
|
/* New scheme for garbage collection */
|
||||||
#define GUILE_NEW_GC_SCHEME
|
#define GUILE_NEW_GC_SCHEME
|
||||||
|
|
||||||
|
@ -250,6 +253,7 @@ typedef long SCM_STACKITEM;
|
||||||
#define SCM_THREAD_SWITCHING_CODE
|
#define SCM_THREAD_SWITCHING_CODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
extern unsigned int scm_async_clock;
|
extern unsigned int scm_async_clock;
|
||||||
|
|
||||||
#define SCM_ASYNC_TICK \
|
#define SCM_ASYNC_TICK \
|
||||||
|
@ -257,6 +261,15 @@ do { \
|
||||||
if (0 == --scm_async_clock) \
|
if (0 == --scm_async_clock) \
|
||||||
scm_async_click (); \
|
scm_async_click (); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
#else
|
||||||
|
extern int scm_asyncs_pending_p;
|
||||||
|
|
||||||
|
#define SCM_ASYNC_TICK /*fixme* should change names */ \
|
||||||
|
do { \
|
||||||
|
if (scm_asyncs_pending_p) \
|
||||||
|
scm_async_click (); \
|
||||||
|
} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SCM_CAREFUL_INTS
|
#ifdef SCM_CAREFUL_INTS
|
||||||
#define SCM_CHECK_NOT_DISABLED \
|
#define SCM_CHECK_NOT_DISABLED \
|
||||||
|
|
|
@ -94,10 +94,11 @@
|
||||||
* when the interpreter is not running at all.
|
* when the interpreter is not running at all.
|
||||||
*/
|
*/
|
||||||
int scm_ints_disabled = 1;
|
int scm_ints_disabled = 1;
|
||||||
|
unsigned int scm_mask_ints = 1;
|
||||||
|
|
||||||
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
unsigned int scm_async_clock = 20;
|
unsigned int scm_async_clock = 20;
|
||||||
static unsigned int scm_async_rate = 20;
|
static unsigned int scm_async_rate = 20;
|
||||||
unsigned int scm_mask_ints = 1;
|
|
||||||
|
|
||||||
static unsigned int scm_tick_clock = 0;
|
static unsigned int scm_tick_clock = 0;
|
||||||
static unsigned int scm_tick_rate = 0;
|
static unsigned int scm_tick_rate = 0;
|
||||||
|
@ -105,11 +106,15 @@ static unsigned int scm_desired_tick_rate = 0;
|
||||||
static unsigned int scm_switch_clock = 0;
|
static unsigned int scm_switch_clock = 0;
|
||||||
static unsigned int scm_switch_rate = 0;
|
static unsigned int scm_switch_rate = 0;
|
||||||
static unsigned int scm_desired_switch_rate = 0;
|
static unsigned int scm_desired_switch_rate = 0;
|
||||||
|
#else
|
||||||
|
int scm_asyncs_pending_p = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
static long scm_tc16_async;
|
static long scm_tc16_async;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
int
|
int
|
||||||
scm_asyncs_pending ()
|
scm_asyncs_pending ()
|
||||||
{
|
{
|
||||||
|
@ -128,14 +133,12 @@ scm_asyncs_pending ()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static SCM
|
static SCM
|
||||||
scm_sys_tick_async_thunk (void)
|
scm_sys_tick_async_thunk (void)
|
||||||
{
|
{
|
||||||
scm_deliver_signal (SCM_TICK_SIGNAL);
|
scm_deliver_signal (SCM_TICK_SIGNAL);
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_async_click ()
|
scm_async_click ()
|
||||||
|
@ -252,19 +255,30 @@ scm_async_click ()
|
||||||
scm_switch ();
|
scm_switch ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
void
|
||||||
|
scm_async_click ()
|
||||||
|
{
|
||||||
|
if (!scm_mask_ints)
|
||||||
|
do
|
||||||
|
scm_run_asyncs (scm_asyncs);
|
||||||
|
while (scm_asyncs_pending_p);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if 0 /* Thread switching code should probably reside here, but the
|
||||||
|
async switching code doesn't seem to work, so it's put in the
|
||||||
|
SCM_DEFER_INTS macro instead. /mdj */
|
||||||
void
|
void
|
||||||
scm_switch ()
|
scm_switch ()
|
||||||
{
|
{
|
||||||
#if 0 /* Thread switching code should probably reside here, but the
|
|
||||||
async switching code doesn't seem to work, so it's put in the
|
|
||||||
SCM_ASYNC_TICK macro instead. /mdj */
|
|
||||||
SCM_THREAD_SWITCHING_CODE;
|
SCM_THREAD_SWITCHING_CODE;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -311,7 +325,11 @@ SCM_DEFINE (scm_async_mark, "async-mark", 1, 0, 0,
|
||||||
{
|
{
|
||||||
struct scm_async * it;
|
struct scm_async * it;
|
||||||
SCM_VALIDATE_ASYNC_COPY (1,a,it);
|
SCM_VALIDATE_ASYNC_COPY (1,a,it);
|
||||||
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
it->got_it = 1;
|
it->got_it = 1;
|
||||||
|
#else
|
||||||
|
scm_asyncs_pending_p = it->got_it = 1;
|
||||||
|
#endif
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
@ -325,9 +343,13 @@ SCM_DEFINE (scm_system_async_mark, "system-async-mark", 1, 0, 0,
|
||||||
struct scm_async * it;
|
struct scm_async * it;
|
||||||
SCM_VALIDATE_ASYNC_COPY (1,a,it);
|
SCM_VALIDATE_ASYNC_COPY (1,a,it);
|
||||||
SCM_REDEFER_INTS;
|
SCM_REDEFER_INTS;
|
||||||
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
it->got_it = 1;
|
it->got_it = 1;
|
||||||
scm_async_rate = 1 + scm_async_rate - scm_async_clock;
|
scm_async_rate = 1 + scm_async_rate - scm_async_clock;
|
||||||
scm_async_clock = 1;
|
scm_async_clock = 1;
|
||||||
|
#else
|
||||||
|
scm_asyncs_pending_p = it->got_it = 1;
|
||||||
|
#endif
|
||||||
SCM_REALLOW_INTS;
|
SCM_REALLOW_INTS;
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
@ -339,13 +361,16 @@ SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_run_asyncs
|
#define FUNC_NAME s_scm_run_asyncs
|
||||||
{
|
{
|
||||||
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
if (scm_mask_ints)
|
if (scm_mask_ints)
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
#endif
|
||||||
|
scm_asyncs_pending_p = 0;
|
||||||
while (list_of_a != SCM_EOL)
|
while (list_of_a != SCM_EOL)
|
||||||
{
|
{
|
||||||
SCM a;
|
SCM a;
|
||||||
struct scm_async * it;
|
struct scm_async * it;
|
||||||
SCM_VALIDATE_CONS (1,list_of_a);
|
SCM_VALIDATE_CONS (1, list_of_a);
|
||||||
a = SCM_CAR (list_of_a);
|
a = SCM_CAR (list_of_a);
|
||||||
SCM_VALIDATE_ASYNC_COPY (SCM_ARG1,a,it);
|
SCM_VALIDATE_ASYNC_COPY (SCM_ARG1,a,it);
|
||||||
scm_mask_ints = 1;
|
scm_mask_ints = 1;
|
||||||
|
@ -376,6 +401,8 @@ SCM_DEFINE (scm_noop, "noop", 0, 0, 1,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
|
|
||||||
SCM_DEFINE (scm_set_tick_rate, "set-tick-rate", 1, 0, 0,
|
SCM_DEFINE (scm_set_tick_rate, "set-tick-rate", 1, 0, 0,
|
||||||
(SCM n),
|
(SCM n),
|
||||||
"")
|
"")
|
||||||
|
@ -407,6 +434,7 @@ SCM_DEFINE (scm_set_switch_rate, "set-switch-rate", 1, 0, 0,
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* points to the GC system-async, so that scm_gc_end can find it. */
|
/* points to the GC system-async, so that scm_gc_end can find it. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue