mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Add test for CONFIG_SEM_PREALLOCHOLDERS > 0
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1597 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1639,6 +1639,13 @@ The system can be re-made subsequently by just typing <code>make</code>.
|
||||
are only using semaphores as mutexes (only one holder) OR if no more
|
||||
than two threads participate using a counting semaphore.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_SEM_NNESTPRIO. </code>: If priority inheritance is enabled,
|
||||
then this setting is the maximum number of higher priority threads (minus
|
||||
1) than can be waiting for another thread to release a count on a semaphore.
|
||||
This value may be set to zero if no more than one thread is expected to
|
||||
wait for a semaphore.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -207,6 +207,12 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
are only using semaphores as mutexes (only one holder) OR
|
||||
if no more than two threads participate using a counting
|
||||
semaphore.
|
||||
CONFIG_SEM_NNESTPRIO. If priority inheritance is enabled,
|
||||
then this setting is the maximum number of higher priority
|
||||
threads (minus 1) than can be waiting for another thread
|
||||
to release a count on a semaphore. This value may be set
|
||||
to zero if no more than one thread is expected to wait for
|
||||
a semaphore.
|
||||
|
||||
The following can be used to disable categories of APIs supported
|
||||
by the OS. If the compiler supports weak functions, then it
|
||||
|
||||
@@ -93,6 +93,11 @@ CONFIG_ARCH_BOARD_SIM=y
|
||||
# is disabled OR if you are only using semaphores as mutexes (only
|
||||
# one holder) OR if no more than two threads participate using a
|
||||
# counting semaphore.
|
||||
# CONFIG_SEM_NNESTPRIO. If priority inheritance is enabled, then this
|
||||
# setting is the maximum number of higher priority threads (minus 1)
|
||||
# than can be waiting for another thread to release a count on a
|
||||
# semaphore. This value may be set to zero if no more than one
|
||||
# thread is expected to wait for a semaphore.
|
||||
#
|
||||
CONFIG_EXAMPLE=ostest
|
||||
CONFIG_DEBUG=y
|
||||
@@ -110,7 +115,8 @@ CONFIG_DEV_CONSOLE=y
|
||||
CONFIG_DEV_LOWCONSOLE=n
|
||||
CONFIG_MUTEX_TYPES=y
|
||||
CONFIG_PRIORITY_INHERITANCE=n
|
||||
CONFIG_SEM_PREALLOCHOLDERS=3
|
||||
CONFIG_SEM_PREALLOCHOLDERS=0
|
||||
CONFIG_SEM_NNESTPRIO=0
|
||||
|
||||
#
|
||||
# The following can be used to disable categories of
|
||||
|
||||
@@ -60,7 +60,11 @@
|
||||
# define CONFIG_SEM_PREALLOCHOLDERS 0
|
||||
#endif
|
||||
#define NLOWPRI_THREADS (CONFIG_SEM_PREALLOCHOLDERS+1)
|
||||
#define NHIGHPRI_THREADS 1
|
||||
|
||||
#ifndef CONFIG_SEM_NNESTPRIO
|
||||
# define CONFIG_SEM_NNESTPRIO 0
|
||||
#endif
|
||||
#define NHIGHPRI_THREADS (CONFIG_SEM_NNESTPRIO+1)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
|
||||
+3
-6
@@ -252,9 +252,6 @@ static int sem_boostholderprio(struct semholder_s *pholder, FAR sem_t *sem, FAR
|
||||
{
|
||||
FAR _TCB *htcb = (FAR _TCB *)pholder->holder;
|
||||
FAR _TCB *rtcb = (FAR _TCB*)arg;
|
||||
#if CONFIG_SEM_NNESTPRIO > 0
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Make sure that the thread is still active. If it exited without releasing
|
||||
* its counts, then that would be a bad thing. But we can take no real
|
||||
@@ -301,7 +298,7 @@ static int sem_boostholderprio(struct semholder_s *pholder, FAR sem_t *sem, FAR
|
||||
}
|
||||
else
|
||||
{
|
||||
sdgb("CONFIG_SEM_NNESTPRIO exceeded\n");
|
||||
sdbg("CONFIG_SEM_NNESTPRIO exceeded\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +355,7 @@ static int sem_verifyholder(struct semholder_s *pholder, FAR sem_t *sem, FAR voi
|
||||
FAR _TCB *htcb = (FAR _TCB *)pholder->holder;
|
||||
|
||||
#if CONFIG_SEM_NNESTPRIO > 0
|
||||
DEBUGASSERT(htcb->npend_repri == 0);
|
||||
DEBUGASSERT(htcb->npend_reprio == 0);
|
||||
#endif
|
||||
DEBUGASSERT(htcb->sched_priority == htcb->base_priority);
|
||||
return 0;
|
||||
@@ -404,7 +401,7 @@ static int sem_restoreholderprio(struct semholder_s *pholder, FAR sem_t *sem, FA
|
||||
{
|
||||
/* No... the thread has only been boosted once */
|
||||
|
||||
DEBUGASSERT(hctb->sched_priority == stcb->sched_priority && npend_reprio == 0);
|
||||
DEBUGASSERT(htcb->sched_priority == stcb->sched_priority && htcb->npend_reprio == 0);
|
||||
rpriority = htcb->base_priority;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user