From dc5ec457e96f2c2e874f0626e0d8399ce136a4b3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 11 Mar 2007 22:19:01 +0000 Subject: Divided _task_init() in several smaller functions that take fewer paramters. This was necessary to reduce the stack usage for the 8051/2 which has a tiny, 256 byte stack git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@58 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/sched/pthread_create.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'nuttx/sched/pthread_create.c') diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c index 72a5b4a81..33fdcf00f 100644 --- a/nuttx/sched/pthread_create.c +++ b/nuttx/sched/pthread_create.c @@ -167,12 +167,12 @@ static void pthread_start(void) * Input Parameters: * thread * attr - * startRoutine + * start_routine * arg ************************************************************/ int pthread_create(pthread_t *thread, pthread_attr_t *attr, - pthread_startroutine_t startRoutine, + pthread_startroutine_t start_routine, pthread_addr_t arg) { FAR _TCB *ptcb; @@ -268,12 +268,10 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr, #endif } - /* Initialize the task */ + /* Initialize the task control block */ - argv[0] = (char *)arg; - argv[1] = NULL; - status = _task_init(ptcb, NULL, priority, pthread_start, - (main_t)startRoutine, TRUE, argv); + status = task_schedsetup(ptcb, priority, pthread_start, + (main_t)start_routine); if (status != OK) { @@ -282,6 +280,14 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr, return ERROR; } + /* Configure the TCB for a pthread receiving on parameter + * passed by value + */ + + argv[0] = (char *)arg; + argv[1] = NULL; + (void)task_argsetup(ptcb, NULL, TRUE, argv); + /* Attach the join info to the TCB. */ ptcb->joininfo = (void*)pjoin; -- cgit v1.2.3