* These may be defined or undefined.
*/
+/* Old async mechanism */
+/* #define GUILE_OLD_ASYNC_CLICK */
+
/* New scheme for garbage collection */
#define GUILE_NEW_GC_SCHEME
#define SCM_THREAD_SWITCHING_CODE
#endif
+#ifdef GUILE_OLD_ASYNC_CLICK
extern unsigned int scm_async_clock;
#define SCM_ASYNC_TICK \
if (0 == --scm_async_clock) \
scm_async_click (); \
} 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
#define SCM_CHECK_NOT_DISABLED \
* when the interpreter is not running at all.
*/
int scm_ints_disabled = 1;
+unsigned int scm_mask_ints = 1;
+#ifdef GUILE_OLD_ASYNC_CLICK
unsigned int scm_async_clock = 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_rate = 0;
static unsigned int scm_switch_clock = 0;
static unsigned int scm_switch_rate = 0;
static unsigned int scm_desired_switch_rate = 0;
+#else
+int scm_asyncs_pending_p = 0;
+#endif
static long scm_tc16_async;
\f
+#ifdef GUILE_OLD_ASYNC_CLICK
int
scm_asyncs_pending ()
{
return 0;
}
-#if 0
static SCM
scm_sys_tick_async_thunk (void)
{
scm_deliver_signal (SCM_TICK_SIGNAL);
return SCM_BOOL_F;
}
-#endif
void
scm_async_click ()
scm_switch ();
}
+#else
+
+void
+scm_async_click ()
+{
+ if (!scm_mask_ints)
+ do
+ scm_run_asyncs (scm_asyncs);
+ while (scm_asyncs_pending_p);
+}
+#endif
\f
+#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
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;
-#endif
}
+#endif
\f
{
struct scm_async * it;
SCM_VALIDATE_ASYNC_COPY (1,a,it);
+#ifdef GUILE_OLD_ASYNC_CLICK
it->got_it = 1;
+#else
+ scm_asyncs_pending_p = it->got_it = 1;
+#endif
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
struct scm_async * it;
SCM_VALIDATE_ASYNC_COPY (1,a,it);
SCM_REDEFER_INTS;
+#ifdef GUILE_OLD_ASYNC_CLICK
it->got_it = 1;
scm_async_rate = 1 + scm_async_rate - scm_async_clock;
scm_async_clock = 1;
+#else
+ scm_asyncs_pending_p = it->got_it = 1;
+#endif
SCM_REALLOW_INTS;
return SCM_UNSPECIFIED;
}
"")
#define FUNC_NAME s_scm_run_asyncs
{
+#ifdef GUILE_OLD_ASYNC_CLICK
if (scm_mask_ints)
return SCM_BOOL_F;
+#endif
+ scm_asyncs_pending_p = 0;
while (list_of_a != SCM_EOL)
{
SCM a;
struct scm_async * it;
- SCM_VALIDATE_CONS (1,list_of_a);
+ SCM_VALIDATE_CONS (1, list_of_a);
a = SCM_CAR (list_of_a);
SCM_VALIDATE_ASYNC_COPY (SCM_ARG1,a,it);
scm_mask_ints = 1;
\f
+#ifdef GUILE_OLD_ASYNC_CLICK
+
SCM_DEFINE (scm_set_tick_rate, "set-tick-rate", 1, 0, 0,
(SCM n),
"")
}
#undef FUNC_NAME
+#endif
\f
/* points to the GC system-async, so that scm_gc_end can find it. */