mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
sched/task: fix gettid by moving tls_dup_info after child pid initialization
Move tls_dup_info() call to after child process priority is set, ensuring the child's pid is properly initialized before duplicating TLS information. This fixes incorrect thread ID assignment during task fork operations. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
c95b6b1bb6
commit
0f7c992cea
1 changed files with 8 additions and 8 deletions
|
|
@ -221,14 +221,6 @@ FAR struct tcb_s *nxtask_setup_fork(start_t retaddr)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Setup thread local storage */
|
||||
|
||||
ret = tls_dup_info(child, parent);
|
||||
if (ret < OK)
|
||||
{
|
||||
goto errout_with_tcb;
|
||||
}
|
||||
|
||||
/* Get the priority of the parent task */
|
||||
|
||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||
|
|
@ -247,6 +239,14 @@ FAR struct tcb_s *nxtask_setup_fork(start_t retaddr)
|
|||
goto errout_with_tcb;
|
||||
}
|
||||
|
||||
/* Setup thread local storage */
|
||||
|
||||
ret = tls_dup_info(child, parent);
|
||||
if (ret < OK)
|
||||
{
|
||||
goto errout_with_tcb;
|
||||
}
|
||||
|
||||
/* Setup to pass parameters to the new task */
|
||||
|
||||
ret = nxtask_setup_stackargs(child, argv[0], &argv[1]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue