summaryrefslogtreecommitdiff
path: root/nuttx/sched/group_find.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-05 19:50:37 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-05 19:50:37 +0000
commit0d9fb476ea6f347c48a3ac8c2d98251467421203 (patch)
treee98b731e1ff4298ed906fde23198fb4d9a9d61a9 /nuttx/sched/group_find.c
parent70121d6ca8fd0e48f35b3ccb52e3b960e64df6c2 (diff)
downloadpx4-nuttx-0d9fb476ea6f347c48a3ac8c2d98251467421203.tar.gz
px4-nuttx-0d9fb476ea6f347c48a3ac8c2d98251467421203.tar.bz2
px4-nuttx-0d9fb476ea6f347c48a3ac8c2d98251467421203.zip
Moving pending signals to task group; Logic to recover some MQ resources on pthread_cacancel or task_delete; Now obeys rules for delivering signals to a process with threads
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5613 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/group_find.c')
-rw-r--r--nuttx/sched/group_find.c52
1 files changed, 49 insertions, 3 deletions
diff --git a/nuttx/sched/group_find.c b/nuttx/sched/group_find.c
index 8683990dd..d7e82d1f9 100644
--- a/nuttx/sched/group_find.c
+++ b/nuttx/sched/group_find.c
@@ -76,7 +76,7 @@
*****************************************************************************/
/*****************************************************************************
- * Name: group_find
+ * Name: group_findbygid
*
* Description:
* Given a group ID, find the group task structure with that ID. IDs are
@@ -100,12 +100,12 @@
*****************************************************************************/
#ifdef HAVE_GROUP_MEMBERS
-FAR struct task_group_s *group_find(gid_t gid)
+FAR struct task_group_s *group_findbygid(gid_t gid)
{
FAR struct task_group_s *group;
irqstate_t flags;
- /* Find the status structure with the matching PID */
+ /* Find the status structure with the matching GID */
flags = irqsave();
for (group = g_grouphead; group; group = group->flink)
@@ -122,4 +122,50 @@ FAR struct task_group_s *group_find(gid_t gid)
}
#endif
+/*****************************************************************************
+ * Name: group_findbygid
+ *
+ * Description:
+ * Given a task ID, find the group task structure with was started by that
+ * task ID. That task's ID is retained in the group as tg_task and will
+ * be remember even if the main task thread leaves the group.
+ *
+ * Parameters:
+ * pid - The task ID of the main task thread.
+ *
+ * Return Value:
+ * On success, a pointer to the group task structure is returned. This
+ * function can fail only if there is no group that corresponds to the
+ * task ID.
+ *
+ * Assumptions:
+ * Called during when signally tasks in a safe context. No special
+ * precautions should be required here. However, extra care is taken when
+ * accessing the global g_grouphead list.
+ *
+ *****************************************************************************/
+
+#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SCHED_HAVE_PARENT)
+FAR struct task_group_s *group_findbypid(pid_t pid)
+{
+ FAR struct task_group_s *group;
+ irqstate_t flags;
+
+ /* Find the status structure with the matching PID */
+
+ flags = irqsave();
+ for (group = g_grouphead; group; group = group->flink)
+ {
+ if (group->tg_task == pid)
+ {
+ irqrestore(flags);
+ return group;
+ }
+ }
+
+ irqrestore(flags);
+ return NULL;
+}
+#endif
+
#endif /* HAVE_TASK_GROUP */