This is the mail archive of the
pthreads-win32@sourceware.org
mailing list for the pthreas-win32 project.
Re: Allocating a thread to a specific processor core
- From: "ross.johnson" <ross dot johnson at loungebythelake dot net>
- To: John Emmas <john at creativepost dot co dot uk>, pthreads-win32 at sourceware dot org
- Date: Mon, 14 May 2018 20:29:29 +1000
- Subject: Re: Allocating a thread to a specific processor core
- Savedfromemail: ross dot johnson at loungebythelake dot net
John,
I notice your question came via the old Red Hat sourceware repository mailing list. The project moved to sourceforge several years ago.
The current head revision at
https://sourceforge.net/p/pthreads4w/wiki/Home/
(code at)
https://sourceforge.net/p/pthreads4w/code/ci/master/tree/
provides the following functions:
pthread_attr_getaffinity_nppthread_attr_setaffinity_nppthread_getaffinity_nppthread_setaffinity_np
and supporting macros/functions:
CPU_ZEROCPU_EQUALCPU_COUNTCPU_SETCPU_CLRCPU_ISSETCPU_ANDCPU_ORCPU_XOR
They follow the Linux functions of the same name. See the manual pages included in the code repository.
In case you're looking for binary versions of the library, the Sourceforge project doesn't produce built versions of the library anymore, assuming that users will be able to and prefer to build their own.
RegardsRoss
Sent from my phone
-------- Original message --------From: John Emmas <john@creativepost.co.uk> Date: 14/5/18 6:08 pm (GMT+10:00) To: pthreads-win32@sourceware.org Subject: Allocating a thread to a specific processor core
When using 'pthread_create()' (on Windows) is it possible to specify a
preferred processor/core for the thread to run on (in the attributes maybe?)
Windows itself has a function for doing this but I just wondered if
there's anything similar that's already available in libpthread?
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686253%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
Thanks,
John