mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
sched: Disable priority inheritance on all semaphores used for signaling
This commit is contained in:
@@ -49,9 +49,10 @@
|
||||
#include <errno.h>
|
||||
#include <queue.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sempahore.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "group/group.h"
|
||||
@@ -498,6 +499,20 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr,
|
||||
ret = sem_init(&pjoin->exit_sem, 0, 0);
|
||||
}
|
||||
|
||||
/* Thse semaphores are used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
ret = sem_setprotocol(&pjoin->data_sem, SEM_PRIO_NONE);
|
||||
}
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
ret = sem_setprotocol(&pjoin->exit_sem, SEM_PRIO_NONE);
|
||||
}
|
||||
|
||||
/* If the priority of the new pthread is lower than the priority of the
|
||||
* parent thread, then starting the pthread could result in both the
|
||||
* parent and the pthread to be blocked. This is a recipe for priority
|
||||
|
||||
Reference in New Issue
Block a user