mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 21:34:07 +08:00
pthread: remove unused temp change sched_priority
old:
pthread_create:
init_priority = prio;
if (sched_priority < parent_prio)
sched_priority = parent_prio; // don't need
pthread_start:
if (sched_priority > init_priority)
sched_priority = init_priority
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
@@ -460,24 +460,6 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread,
|
||||
|
||||
pid = ptcb->cmn.pid;
|
||||
|
||||
/* 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
|
||||
* inversion issues.
|
||||
*
|
||||
* We avoid this here by boosting the priority of the (inactive) pthread
|
||||
* so it has the same priority as the parent thread.
|
||||
*/
|
||||
|
||||
if (ptcb->cmn.sched_priority < parent->sched_priority)
|
||||
{
|
||||
ret = nxsched_set_priority(&ptcb->cmn, parent->sched_priority);
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Then activate the task */
|
||||
|
||||
sched_lock();
|
||||
|
||||
Reference in New Issue
Block a user