libblockdriver: increase stack size to 8KB per thread

This commit is contained in:
David van Moolenbroek 2012-02-09 22:28:18 +01:00
parent 35abd4867a
commit de89517711
2 changed files with 12 additions and 1 deletions

View file

@ -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

View file

@ -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);
}