Maratyszcza / pthreadpool

Portable (POSIX/Windows/Emscripten) thread pool for C/C++
BSD 2-Clause "Simplified" License
342 stars 132 forks source link

Set cpu affinity through pthreadpool_create() #44

Closed lk-chen closed 4 months ago

lk-chen commented 5 months ago

Currently pthreadpool_create() only take a size_t indicating number of threads. Shall we add capability to specify cpu affinity?

Maratyszcza commented 4 months ago

Affinity is not portable, e.g. macOS doesn't support it. The best we can do is provide a hint of the current CPU core, similarly to pthreadpool_parallelize_*_with_thread functions.