From: David van Moolenbroek Date: Thu, 9 Feb 2012 21:28:18 +0000 (+0100) Subject: libblockdriver: increase stack size to 8KB per thread X-Git-Tag: v3.2.0~48 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=de8951771162c140e4be81b129dc05ca6e220d77;p=minix.git libblockdriver: increase stack size to 8KB per thread --- diff --git a/lib/libblockdriver/const.h b/lib/libblockdriver/const.h index 941c4391c..5f475e3e9 100644 --- a/lib/libblockdriver/const.h +++ b/lib/libblockdriver/const.h @@ -1,6 +1,9 @@ #ifndef _BLOCKDRIVER_CONST_H #define _BLOCKDRIVER_CONST_H +/* Thread stack size. */ +#define STACK_SIZE 8192 + /* Maximum number of devices supported. */ #define MAX_DEVICES 32 diff --git a/lib/libblockdriver/driver_mt.c b/lib/libblockdriver/driver_mt.c index 0ec53e31e..b3c686c14 100644 --- a/lib/libblockdriver/driver_mt.c +++ b/lib/libblockdriver/driver_mt.c @@ -212,6 +212,7 @@ PRIVATE void master_create_worker(worker_t *wp, worker_id_t worker_id, { /* Start a new worker thread. */ + mthread_attr_t attr; int r; wp->device_id = device_id; @@ -221,8 +222,15 @@ PRIVATE void master_create_worker(worker_t *wp, worker_id_t worker_id, /* Initialize synchronization primitives. */ mthread_event_init(&wp->sleep_event); - r = mthread_create(&wp->mthread, NULL /*attr*/, worker_thread, (void *) wp); + r = mthread_attr_init(&attr); + if (r != 0) + panic("blockdriver_mt: could not initialize attributes (%d)", r); + + r = mthread_attr_setstacksize(&attr, STACK_SIZE); + if (r != 0) + panic("blockdriver_mt: could not set stack size (%d)", r); + r = mthread_create(&wp->mthread, &attr, worker_thread, (void *) wp); if (r != 0) panic("blockdriver_mt: could not start thread %d (%d)", worker_id, r); }