Stefan Krah <stefan-use...@bytereef.org> added the comment: Charles-François Natali <rep...@bugs.python.org> wrote: > Out of curiosity, I just looked at the source code, and it just does > sched_setaffinity(thread->tid), so you can do the same with > sched_setaffinity(syscall(SYS_gettid)) for the current thread.
sched_setaffinity(syscall(SYS_gettid), size, cpusetp) crashes, too. This seems to be a violation of the man page, which states: "The value returned from a call to gettid(2) can be passed in the argument pid." Unless one uses a somewhat warped interpretation that linking against pthread constitutes "using the POSIX threads API". That would be the only loophole that would allow the crash. > However, I don't think we should/could add this to the posix module: > it expects a pthread_t instead of a PID, to which we don't have access. If we have access (and as I understood from Victor's post we do): pthread_getaffinity_np() also exists on FreeBSD, which would be an advantage. > So I'd suggest closing this issue. I don't care strongly about using pthread_getaffinity_np(), but at least I'd like to skip the scheduling sections on arm-linux if they don't work reliably. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12936> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com