let update thread run longer to avoid flicker on Mac OS (especially now that the text% offscreen buffer is disabled)

svn: r7730
This commit is contained in:
Matthew Flatt 2007-11-15 02:53:38 +00:00
parent 86ee638d2a
commit a9ddbb33e4
2 changed files with 16 additions and 0 deletions

View File

@ -3697,6 +3697,7 @@ int wxHiEventTrampoline(int (*_wha_f)(void *), void *wha_data)
static void suspend_het_progress(void) static void suspend_het_progress(void)
{ {
HiEventTramp * volatile het; HiEventTramp * volatile het;
double msecs;
{ {
Scheme_Object *v; Scheme_Object *v;
@ -3704,6 +3705,10 @@ static void suspend_het_progress(void)
het = (HiEventTramp *)SCHEME_CAR(v); het = (HiEventTramp *)SCHEME_CAR(v);
} }
msecs = scheme_get_inexact_milliseconds();
if (msecs < het->continue_until)
return;
scheme_on_atomic_timeout = NULL; scheme_on_atomic_timeout = NULL;
het->yielding = 0; het->yielding = 0;
@ -3725,11 +3730,18 @@ static void suspend_het_progress(void)
} }
} }
#define HET_RUN_MSECS 200
static void het_run_new(HiEventTramp * volatile het) static void het_run_new(HiEventTramp * volatile het)
{ {
double msecs;
/* We're willing to start new work that is specific to this thread */ /* We're willing to start new work that is specific to this thread */
het->progress_is_resumed = 0; het->progress_is_resumed = 0;
msecs = scheme_get_inexact_milliseconds();
het->continue_until = msecs + HET_RUN_MSECS;
if (!scheme_setjmp(het->progress_base)) { if (!scheme_setjmp(het->progress_base)) {
scheme_start_atomic(); scheme_start_atomic();
scheme_on_atomic_timeout = CAST_SUSPEND suspend_het_progress; scheme_on_atomic_timeout = CAST_SUSPEND suspend_het_progress;
@ -3790,8 +3802,11 @@ int mred_het_run_some(HiEventTrampProc do_f, void *do_data)
/* We have work in progress. */ /* We have work in progress. */
if ((unsigned long)het->progress_base_addr < get_deeper_base()) { if ((unsigned long)het->progress_base_addr < get_deeper_base()) {
/* We have stack space to resume the old work: */ /* We have stack space to resume the old work: */
double msecs;
het->in_progress = 0; het->in_progress = 0;
het->progress_is_resumed = 1; het->progress_is_resumed = 1;
msecs = scheme_get_inexact_milliseconds();
het->continue_until = msecs + HET_RUN_MSECS;
scheme_start_atomic(); scheme_start_atomic();
scheme_on_atomic_timeout = CAST_SUSPEND suspend_het_progress; scheme_on_atomic_timeout = CAST_SUSPEND suspend_het_progress;
if (!scheme_setjmp(het->progress_base)) { if (!scheme_setjmp(het->progress_base)) {

View File

@ -149,6 +149,7 @@ public:
Scheme_Jumpup_Buf_Holder *progress_cont; Scheme_Jumpup_Buf_Holder *progress_cont;
int timer_on; int timer_on;
HET_TIMER_T timer_id; HET_TIMER_T timer_id;
double continue_until;
#ifdef MZ_PRECISE_GC #ifdef MZ_PRECISE_GC
void *fixup_var_stack_chain; void *fixup_var_stack_chain;
#endif #endif