mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
sched: inherit parent priority by default
fix ltp pthread_cond_wait_1 test question, child should inherit parent priority by default. nsh> ltp_pthread_cond_wait_1 Error: the policy or priority not correct Signed-off-by: yangyalei <yangyalei@xiaomi.com>
This commit is contained in:
@@ -185,14 +185,21 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread,
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
int ret;
|
int ret;
|
||||||
bool group_joined = false;
|
bool group_joined = false;
|
||||||
|
pthread_attr_t default_attr = g_default_pthread_attr;
|
||||||
|
|
||||||
DEBUGASSERT(trampoline != NULL);
|
DEBUGASSERT(trampoline != NULL);
|
||||||
|
|
||||||
|
parent = this_task();
|
||||||
|
DEBUGASSERT(parent != NULL);
|
||||||
|
|
||||||
/* If attributes were not supplied, use the default attributes */
|
/* If attributes were not supplied, use the default attributes */
|
||||||
|
|
||||||
if (!attr)
|
if (!attr)
|
||||||
{
|
{
|
||||||
attr = &g_default_pthread_attr;
|
/* Inherit parent priority by default */
|
||||||
|
|
||||||
|
default_attr.priority = parent->sched_priority;
|
||||||
|
attr = &default_attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a TCB for the new task. */
|
/* Allocate a TCB for the new task. */
|
||||||
@@ -395,9 +402,6 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
parent = this_task();
|
|
||||||
DEBUGASSERT(parent != NULL);
|
|
||||||
|
|
||||||
/* Configure the TCB for a pthread receiving on parameter
|
/* Configure the TCB for a pthread receiving on parameter
|
||||||
* passed by value
|
* passed by value
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user