2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2016-08-07 16:25:30 +02:00
|
|
|
* sched/pthread/pthread_findjoininfo.c
|
2007-02-18 00:21:28 +01:00
|
|
|
*
|
2021-02-08 16:33:58 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-02-18 00:21:28 +01:00
|
|
|
*
|
2021-02-08 16:33:58 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-18 00:21:28 +01:00
|
|
|
*
|
2021-02-08 16:33:58 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-02-18 00:21:28 +01:00
|
|
|
*
|
2015-10-03 01:43:18 +02:00
|
|
|
****************************************************************************/
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2007-02-18 00:21:28 +01:00
|
|
|
* Included Files
|
2015-10-03 01:43:18 +02:00
|
|
|
****************************************************************************/
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2009-12-14 20:30:18 +01:00
|
|
|
#include <nuttx/config.h>
|
2012-07-14 21:30:31 +02:00
|
|
|
|
2007-02-18 00:21:28 +01:00
|
|
|
#include <sys/types.h>
|
2012-07-14 21:30:31 +02:00
|
|
|
|
2014-08-08 22:06:42 +02:00
|
|
|
#include "group/group.h"
|
2014-08-08 20:55:02 +02:00
|
|
|
#include "pthread/pthread.h"
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2007-02-18 00:21:28 +01:00
|
|
|
* Public Functions
|
2015-10-03 01:43:18 +02:00
|
|
|
****************************************************************************/
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2012-07-14 21:30:31 +02:00
|
|
|
* Name: thread_findjoininfo
|
2007-02-18 00:21:28 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2013-02-03 17:43:58 +01:00
|
|
|
* Find a join structure in a local data set.
|
2007-02-18 00:21:28 +01:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2020-03-16 20:42:34 +01:00
|
|
|
* group - The group that the pid is (or was) a member of
|
2013-02-03 17:43:58 +01:00
|
|
|
* pid - The ID of the pthread
|
2007-02-18 00:21:28 +01:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2007-02-18 00:21:28 +01:00
|
|
|
* None or pointer to the found entry.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The caller has provided protection from re-entrancy.
|
|
|
|
*
|
2015-10-03 01:43:18 +02:00
|
|
|
****************************************************************************/
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2013-02-03 17:43:58 +01:00
|
|
|
FAR struct join_s *pthread_findjoininfo(FAR struct task_group_s *group,
|
|
|
|
pid_t pid)
|
2007-02-18 00:21:28 +01:00
|
|
|
{
|
2013-02-03 17:43:58 +01:00
|
|
|
FAR struct join_s *pjoin;
|
|
|
|
|
|
|
|
DEBUGASSERT(group);
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
/* Find the entry with the matching pid */
|
|
|
|
|
2013-02-03 17:43:58 +01:00
|
|
|
for (pjoin = group->tg_joinhead;
|
2007-02-20 23:39:56 +01:00
|
|
|
(pjoin && (pid_t)pjoin->thread != pid);
|
2007-02-18 00:21:28 +01:00
|
|
|
pjoin = pjoin->next);
|
|
|
|
|
|
|
|
/* and return it */
|
|
|
|
|
|
|
|
return pjoin;
|
|
|
|
}
|