2015-12-22 19:06:05 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* sched/group/group_waiter.c
|
|
|
|
*
|
2024-09-11 13:45:11 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
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
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* 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.
|
2015-12-22 19:06:05 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "nuttx/sched.h"
|
|
|
|
#include "group/group.h"
|
|
|
|
|
|
|
|
#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT)
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2020-05-16 17:06:29 +02:00
|
|
|
* Name: group_add_waiter
|
2015-12-22 19:06:05 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Increment the number of instances of waitpid that are waiting for this
|
|
|
|
* group to exit.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Caller has assured mutually exclusive access to the group.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-05-16 17:06:29 +02:00
|
|
|
void group_add_waiter(FAR struct task_group_s *group)
|
2015-12-22 19:06:05 +01:00
|
|
|
{
|
|
|
|
group->tg_nwaiters++;
|
|
|
|
DEBUGASSERT(group->tg_nwaiters > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2020-05-16 17:06:29 +02:00
|
|
|
* Name: group_add_waiter
|
2015-12-22 19:06:05 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Decrement the number of instances of waitpid that are waiting for this
|
|
|
|
* group to exit. If the count goes to zero and deletion is pending, the
|
|
|
|
* call group_free to release the dangling resources.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Caller has assured mutually exclusive access to the group.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-05-16 17:06:29 +02:00
|
|
|
void group_del_waiter(FAR struct task_group_s *group)
|
2015-12-22 19:06:05 +01:00
|
|
|
{
|
|
|
|
DEBUGASSERT(group->tg_nwaiters > 0);
|
|
|
|
group->tg_nwaiters--;
|
2023-01-26 13:45:13 +01:00
|
|
|
group_drop(group);
|
2015-12-22 19:06:05 +01:00
|
|
|
}
|
|
|
|
|
2020-01-31 19:07:39 +01:00
|
|
|
#endif /* CONFIG_SCHED_WAITPID && !CONFIG_SCHED_HAVE_PARENT */
|