forked from RT-Thread/rt-thread
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[smart] update sched_setaffinity() to use thread(task) ID (RT-Thread#…
…9004) Correct `sched_setaffinity()` to use the thread IDs (TIDs) instead of process IDs (PIDs). The previous implementation used PIDs, which caused issues since affinity settings need to be applied at the thread level. As the manual documented, the signature is: > int sched_setaffinity(pid_t pid, size_t cpusetsize, > const cpu_set_t *mask); Yes, it's tricky, the identification passing in is called **'PID'**. But when we talk about 'pid' from GNU libc, it's the **'task-id'**, aka, `thread->tid` known in kernel. Changes were made by updating the function signatures and logic in `lwp.h`, `lwp_pid.c`, and `lwp_syscall.c` to accept TIDs. Specifically, the `lwp_setaffinity` function and related internal functions now operate using thread IDs and adjust thread affinity settings accordingly Signed-off-by: Shell <[email protected]>
- Loading branch information
Showing
3 changed files
with
15 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters