Elaborating Jaganathan's reply:
The header file to include is sched.h, for using CPU_ZERO
and CPU_SET
macros.
If I am right the #define _GNU_SOURCE
macro should also be defined.
cpu_set_t
is a bitset where each bit represents a CPU. How the system’s CPUs are mapped to bits in the bitset is system dependent. To manipulate this bitset, to set and reset bits, a number of macros are defined:
CPU_ZERO, CPU_SET, CPU_CLR
etc.
The pthread_setaffinity_np
, as its already understandable, sets the affinity of thread
to the cpuset
defined above using CPU_SET
macro.
Regards,
Upayan.