summaryrefslogtreecommitdiff
path: root/nuttx/sched/task_create.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-25 19:15:05 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-25 19:15:05 +0000
commite1ff898b022bc77ede6ba57e8ecb46f0af306149 (patch)
treeeb49c2f705d2255cc6f05a7ee433aa87472c8a88 /nuttx/sched/task_create.c
parentf2933cc4b65836a712f1ab996512999959a8c48a (diff)
downloadpx4-nuttx-e1ff898b022bc77ede6ba57e8ecb46f0af306149.tar.gz
px4-nuttx-e1ff898b022bc77ede6ba57e8ecb46f0af306149.tar.bz2
px4-nuttx-e1ff898b022bc77ede6ba57e8ecb46f0af306149.zip
Add logic to keep track of members of a task group
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5563 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/task_create.c')
-rw-r--r--nuttx/sched/task_create.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/nuttx/sched/task_create.c b/nuttx/sched/task_create.c
index f2aeeeec0..bb309444b 100644
--- a/nuttx/sched/task_create.c
+++ b/nuttx/sched/task_create.c
@@ -120,10 +120,10 @@ static int thread_create(const char *name, uint8_t ttype, int priority,
goto errout;
}
- /* Create a new task group */
+ /* Allocate a new task group */
#ifdef HAVE_TASK_GROUP
- ret = group_create(tcb);
+ ret = group_allocate(tcb);
if (ret < 0)
{
errcode = -ret;
@@ -160,7 +160,7 @@ static int thread_create(const char *name, uint8_t ttype, int priority,
/* Initialize the task control block */
ret = task_schedsetup(tcb, priority, task_start, entry, ttype);
- if (ret != OK)
+ if (ret < OK)
{
errcode = -ret;
goto errout_with_tcb;
@@ -170,6 +170,17 @@ static int thread_create(const char *name, uint8_t ttype, int priority,
(void)task_argsetup(tcb, name, argv);
+ /* Now we have enough in place that we can join the group */
+
+#ifdef HAVE_TASK_GROUP
+ ret = group_initialize(tcb);
+ if (ret < 0)
+ {
+ errcode = -ret;
+ goto errout_with_tcb;
+ }
+#endif
+
/* Get the assigned pid before we start the task */
pid = (int)tcb->pid;