summaryrefslogtreecommitdiff
path: root/nuttx/sched/pthread_create.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-11 22:19:01 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-11 22:19:01 +0000
commitdc5ec457e96f2c2e874f0626e0d8399ce136a4b3 (patch)
tree13a9ee8ef6cfb9e62ad01f65d34e3d82d274db51 /nuttx/sched/pthread_create.c
parent7e354ad57b4d040ab88e2eeb4ac84240e65e0e52 (diff)
downloadpx4-nuttx-dc5ec457e96f2c2e874f0626e0d8399ce136a4b3.tar.gz
px4-nuttx-dc5ec457e96f2c2e874f0626e0d8399ce136a4b3.tar.bz2
px4-nuttx-dc5ec457e96f2c2e874f0626e0d8399ce136a4b3.zip
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
Diffstat (limited to 'nuttx/sched/pthread_create.c')
-rw-r--r--nuttx/sched/pthread_create.c20
1 files changed, 13 insertions, 7 deletions
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;