diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-25 19:15:05 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-25 19:15:05 +0000 |
commit | 80904539e63681b2dca74e3978effb17f0c071b0 (patch) | |
tree | eb49c2f705d2255cc6f05a7ee433aa87472c8a88 /nuttx/sched/pthread_create.c | |
parent | e95efd5d2a08dcb62c8c635089e4fe146965db45 (diff) | |
download | px4-firmware-80904539e63681b2dca74e3978effb17f0c071b0.tar.gz px4-firmware-80904539e63681b2dca74e3978effb17f0c071b0.tar.bz2 px4-firmware-80904539e63681b2dca74e3978effb17f0c071b0.zip |
Add logic to keep track of members of a task group
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5563 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/pthread_create.c')
-rw-r--r-- | nuttx/sched/pthread_create.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c index e37c06892..89a2feb00 100644 --- a/nuttx/sched/pthread_create.c +++ b/nuttx/sched/pthread_create.c @@ -246,13 +246,13 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, { FAR _TCB *ptcb; FAR join_t *pjoin; - int ret; int priority; #if CONFIG_RR_INTERVAL > 0 int policy; #endif int errcode; pid_t pid; + int ret; /* If attributes were not supplied, use the default attributes */ @@ -269,10 +269,17 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, return ENOMEM; } - /* Join the parent's task group */ + /* Bind the parent's group to the new TCB (we have not yet joined the + * group). + */ #ifdef HAVE_TASK_GROUP - group_join(ptcb); + ret = group_bind(ptcb); + if (ret < 0) + { + errcode = ENOMEM; + goto errout_with_tcb; + } #endif /* Share the address environment of the parent task. NOTE: Only tasks @@ -376,6 +383,17 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, pthread_argsetup(ptcb, arg); + /* Join the parent's task group */ + +#ifdef HAVE_TASK_GROUP + ret = group_join(ptcb); + if (ret < 0) + { + errcode = ENOMEM; + goto errout_with_join; + } +#endif + /* Attach the join info to the TCB. */ ptcb->joininfo = (void*)pjoin; |