diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-22 12:32:34 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-22 12:32:34 -0600 |
commit | 440d27c51fed1c66e883a6d0584599e2d0569a94 (patch) | |
tree | 8d392b85ac509e0c0e26d1c4c1a8338417771381 /nuttx/sched | |
parent | 3ee26908593dc30b07686f8cb3f8e23fa8ad12d5 (diff) | |
download | px4-nuttx-440d27c51fed1c66e883a6d0584599e2d0569a94.tar.gz px4-nuttx-440d27c51fed1c66e883a6d0584599e2d0569a94.tar.bz2 px4-nuttx-440d27c51fed1c66e883a6d0584599e2d0569a94.zip |
An address environment is the property of a task group, not of a thread
Diffstat (limited to 'nuttx/sched')
-rw-r--r-- | nuttx/sched/pthread/pthread_create.c | 21 | ||||
-rw-r--r-- | nuttx/sched/sched/sched_releasetcb.c | 4 |
2 files changed, 11 insertions, 14 deletions
diff --git a/nuttx/sched/pthread/pthread_create.c b/nuttx/sched/pthread/pthread_create.c index 9ee5cc5d9..85ec3c5d8 100644 --- a/nuttx/sched/pthread/pthread_create.c +++ b/nuttx/sched/pthread/pthread_create.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/pthread/pthread_create.c * - * Copyright (C) 2007-2009, 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -254,11 +254,11 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, return ENOMEM; } +#ifdef HAVE_TASK_GROUP /* Bind the parent's group to the new TCB (we have not yet joined the * group). */ -#ifdef HAVE_TASK_GROUP ret = group_bind(ptcb); if (ret < 0) { @@ -267,14 +267,11 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, } #endif - /* Share the address environment of the parent task. NOTE: Only tasks - * created throught the nuttx/binfmt loaders may have an address - * environment. - */ - #ifdef CONFIG_ADDRENV - ret = up_addrenv_share((FAR const struct tcb_s *)g_readytorun.head, - (FAR struct tcb_s *)ptcb); + /* Share the address environment of the parent task group. */ + + ret = up_addrenv_attach(ptcb->group, + (FAR const struct tcb_s *)g_readytorun.head); if (ret < 0) { errcode = -ret; @@ -323,9 +320,9 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, priority = SCHED_FIFO; } +#if CONFIG_RR_INTERVAL > 0 /* Get the scheduler policy for this thread */ -#if CONFIG_RR_INTERVAL > 0 policy = sched_getscheduler(0); if (policy == ERROR) { @@ -358,9 +355,9 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, pthread_argsetup(ptcb, arg); +#ifdef HAVE_TASK_GROUP /* Join the parent's task group */ -#ifdef HAVE_TASK_GROUP ret = group_join(ptcb); if (ret < 0) { @@ -373,11 +370,11 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, ptcb->joininfo = (FAR void *)pjoin; +#if CONFIG_RR_INTERVAL > 0 /* If round robin scheduling is selected, set the appropriate flag * in the TCB. */ -#if CONFIG_RR_INTERVAL > 0 if (policy == SCHED_RR) { ptcb->cmn.flags |= TCB_FLAG_ROUND_ROBIN; diff --git a/nuttx/sched/sched/sched_releasetcb.c b/nuttx/sched/sched/sched_releasetcb.c index 7c7eeae3a..3899911f3 100644 --- a/nuttx/sched/sched/sched_releasetcb.c +++ b/nuttx/sched/sched/sched_releasetcb.c @@ -193,10 +193,10 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype) /* Release this thread's reference to the address environment */ #ifdef CONFIG_ADDRENV - ret = up_addrenv_release(tcb); + ret = up_addrenv_detach(tcp->group, tcb); #endif - /* Leave the group (if we did not already leady in task_exithook.c) */ + /* Leave the group (if we did not already leave in task_exithook.c) */ #ifdef HAVE_TASK_GROUP group_leave(tcb); |