mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 01:13:35 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user