sched: Disable priority inheritance on all semaphores used for signaling

This commit is contained in:
Gregory Nutt
2016-11-03 12:42:02 -06:00
parent dbbe46a2bc
commit 1da3a5fa61
3 changed files with 24 additions and 3 deletions
+16 -1
View File
@@ -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