mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 13:27:01 +08:00
sched/semaphore/sem_holder.c: Fix bad line separation.
This commit is contained in:
committed by
Abdelatif Guettouche
parent
7dd5356055
commit
9e40a0d296
@@ -1,36 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/semaphore/sem_holder.c
|
* sched/semaphore/sem_holder.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2011, 2013, 2016-2019 Gregory Nutt. All rights
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* reserved.
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* 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
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -240,7 +224,8 @@ static inline void nxsem_freeholder(sem_t *sem,
|
|||||||
* Name: nxsem_findandfreeholder
|
* Name: nxsem_findandfreeholder
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline void nxsem_findandfreeholder(sem_t *sem, FAR struct tcb_s *htcb)
|
static inline void nxsem_findandfreeholder(sem_t *sem,
|
||||||
|
FAR struct tcb_s *htcb)
|
||||||
{
|
{
|
||||||
FAR struct semholder_s *pholder = nxsem_findholder(sem, htcb);
|
FAR struct semholder_s *pholder = nxsem_findholder(sem, htcb);
|
||||||
|
|
||||||
@@ -373,7 +358,8 @@ static int nxsem_boostholderprio(FAR struct semholder_s *pholder,
|
|||||||
|
|
||||||
if (htcb->npend_reprio < CONFIG_SEM_NNESTPRIO)
|
if (htcb->npend_reprio < CONFIG_SEM_NNESTPRIO)
|
||||||
{
|
{
|
||||||
htcb->pend_reprios[htcb->npend_reprio] = htcb->sched_priority;
|
htcb->pend_reprios[htcb->npend_reprio] =
|
||||||
|
htcb->sched_priority;
|
||||||
htcb->npend_reprio++;
|
htcb->npend_reprio++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -442,8 +428,11 @@ static int nxsem_boostholderprio(FAR struct semholder_s *pholder,
|
|||||||
static int nxsem_verifyholder(FAR struct semholder_s *pholder,
|
static int nxsem_verifyholder(FAR struct semholder_s *pholder,
|
||||||
FAR sem_t *sem, FAR void *arg)
|
FAR sem_t *sem, FAR void *arg)
|
||||||
{
|
{
|
||||||
#if 0 /* Need to revisit this, but these assumptions seem to be untrue -- \
|
/* Need to revisit this, but these assumptions seem to be untrue -- OR
|
||||||
* OR there is a bug??? */
|
* there is a bug???
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if 0
|
||||||
FAR struct tcb_s *htcb = (FAR struct tcb_s *)pholder->htcb;
|
FAR struct tcb_s *htcb = (FAR struct tcb_s *)pholder->htcb;
|
||||||
|
|
||||||
/* Called after a semaphore has been released (incremented), the semaphore
|
/* Called after a semaphore has been released (incremented), the semaphore
|
||||||
@@ -641,15 +630,15 @@ static int nxsem_restoreholderprioall(FAR struct semholder_s *pholder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxsem_restoreholderprioA
|
* Name: nxsem_restoreholderprio_others
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Reprioritize all holders except the currently executing task
|
* Reprioritize all holders except the currently executing task
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxsem_restoreholderprioA(FAR struct semholder_s *pholder,
|
static int nxsem_restoreholderprio_others(FAR struct semholder_s *pholder,
|
||||||
FAR sem_t *sem, FAR void *arg)
|
FAR sem_t *sem, FAR void *arg)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *rtcb = this_task();
|
FAR struct tcb_s *rtcb = this_task();
|
||||||
if (pholder->htcb != rtcb)
|
if (pholder->htcb != rtcb)
|
||||||
@@ -661,15 +650,15 @@ static int nxsem_restoreholderprioA(FAR struct semholder_s *pholder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxsem_restoreholderprioB
|
* Name: nxsem_restoreholderprio_self
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Reprioritize only the currently executing task
|
* Reprioritize only the currently executing task
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxsem_restoreholderprioB(FAR struct semholder_s *pholder,
|
static int nxsem_restoreholderprio_self(FAR struct semholder_s *pholder,
|
||||||
FAR sem_t *sem, FAR void *arg)
|
FAR sem_t *sem, FAR void *arg)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *rtcb = this_task();
|
FAR struct tcb_s *rtcb = this_task();
|
||||||
|
|
||||||
@@ -809,11 +798,11 @@ static inline void nxsem_restorebaseprio_task(FAR struct tcb_s *stcb,
|
|||||||
* except for the running thread.
|
* except for the running thread.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nxsem_foreachholder(sem, nxsem_restoreholderprioA, stcb);
|
nxsem_foreachholder(sem, nxsem_restoreholderprio_others, stcb);
|
||||||
|
|
||||||
/* Now, find an reprioritize only the ready to run task */
|
/* Now, find an reprioritize only the ready to run task */
|
||||||
|
|
||||||
nxsem_foreachholder(sem, nxsem_restoreholderprioB, stcb);
|
nxsem_foreachholder(sem, nxsem_restoreholderprio_self, stcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there are no tasks waiting for available counts, then all holders
|
/* If there are no tasks waiting for available counts, then all holders
|
||||||
@@ -963,8 +952,8 @@ void nxsem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem)
|
|||||||
pholder = nxsem_findorallocateholder(sem, htcb);
|
pholder = nxsem_findorallocateholder(sem, htcb);
|
||||||
if (pholder != NULL)
|
if (pholder != NULL)
|
||||||
{
|
{
|
||||||
/* Then set the holder and increment the number of counts held by this
|
/* Then set the holder and increment the number of counts held by
|
||||||
* holder
|
* this holder
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pholder->htcb = htcb;
|
pholder->htcb = htcb;
|
||||||
@@ -1122,10 +1111,10 @@ void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem)
|
|||||||
* Name: nxsem_canceled
|
* Name: nxsem_canceled
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from nxsem_wait_irq() after a thread that was waiting for a semaphore
|
* Called from nxsem_wait_irq() after a thread that was waiting for a
|
||||||
* count was awakened because of a signal and the semaphore wait has been
|
* semaphore count was awakened because of a signal and the semaphore wait
|
||||||
* cancelled. This function restores the correct thread priority of each
|
* has been canceled. This function restores the correct thread priority
|
||||||
* holder of the semaphore.
|
* of each holder of the semaphore.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* sem - A reference to the semaphore no longer being waited for
|
* sem - A reference to the semaphore no longer being waited for
|
||||||
|
|||||||
Reference in New Issue
Block a user