From 8b334e1e1b60996cac823414ea7f910d79d6cf7e Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Wed, 25 May 2011 12:02:07 -0600 Subject: [PATCH] Smaller stacks for green thread timers --- src/racket/src/port.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/racket/src/port.c b/src/racket/src/port.c index e296fd02c8..4cd3285b7f 100644 --- a/src/racket/src/port.c +++ b/src/racket/src/port.c @@ -8964,7 +8964,7 @@ typedef struct ITimer_Data { int itimer; int state; int die; - pthread_t thread; + mz_proc_thread *thread; pthread_mutex_t mutex; pthread_cond_t cond; int delay; @@ -9008,13 +9008,15 @@ static void *green_thread_timer(void *data) static void start_green_thread_timer(intptr_t usec) { + mz_proc_thread *tmp; itimerdata->die = 0; itimerdata->delay = usec; itimerdata->fuel_counter_ptr = &scheme_fuel_counter; itimerdata->jit_stack_boundary_ptr = &scheme_jit_stack_boundary; pthread_mutex_init(&itimerdata->mutex, NULL); pthread_cond_init(&itimerdata->cond, NULL); - pthread_create(&itimerdata->thread, NULL, green_thread_timer, itimerdata); + tmp = mz_proc_thread_create_w_stacksize(green_thread_timer, itimerdata, 4096); + itimerdata->thread = tmp; itimerdata->itimer = 1; } @@ -9033,7 +9035,8 @@ static void kill_green_thread_timer() asked it to continue */ } pthread_mutex_unlock(&itimerdata->mutex); - pthread_join(itimerdata->thread, &rc); + rc = mz_proc_thread_wait(itimerdata->thread); + free(itimerdata); itimerdata = NULL; }