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
This commit is contained in:
patacongo
2013-01-25 19:15:05 +00:00
parent e95efd5d2a
commit 80904539e6
10 changed files with 299 additions and 57 deletions
+21 -3
View File
@@ -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;