patacongo edited a comment on issue #37: examples: hello: Show CPU index when 
running in SMP mode
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/37#issuecomment-580250205
 
 
   For pthreads, GNU supports the non-POSIX (_np) function so set affinity and 
also:
   
       int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize, FAR 
cpu_set_t *cpuset);
   
   But there is no application interface like this for tasks.  There is the 
internal (only) nxsched_getaffinity().
   
   In NuttX all tasks are the same, so you could argue that 
nxsched_getaffinity() could then become a systen call, replacing the 
pthread_getaffinity_np() system call . sched_getaffinity() and 
pthread_getaffinity_np() would then be demoted to a libs/libc/pthread functions 
that just invoke the nxsched_getaffinity() system call (nxsched_getaffinity() 
would be the system call because the return values are different for the two 
libs/libc/pthread functions.
   
   NOTE that those functions do NOT return the current CPU.  They return the 
CPU set assigned by the setaffinity() interfaces.  They do NOT tell you which 
CPU the thread is running on.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to