summaryrefslogtreecommitdiffstats
path: root/man3/pthread_setaffinity_np.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/pthread_setaffinity_np.3')
-rw-r--r--man3/pthread_setaffinity_np.318
1 files changed, 9 insertions, 9 deletions
diff --git a/man3/pthread_setaffinity_np.3 b/man3/pthread_setaffinity_np.3
index ed2bb82d7..3aa75c196 100644
--- a/man3/pthread_setaffinity_np.3
+++ b/man3/pthread_setaffinity_np.3
@@ -164,37 +164,37 @@ to check the resulting CPU affinity mask of the thread.
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
-
+\&
int
main(void)
{
int s;
cpu_set_t cpuset;
pthread_t thread;
-
+\&
thread = pthread_self();
-
+\&
/* Set affinity mask to include CPUs 0 to 7. */
-
+\&
CPU_ZERO(&cpuset);
for (size_t j = 0; j < 8; j++)
CPU_SET(j, &cpuset);
-
+\&
s = pthread_setaffinity_np(thread, sizeof(cpuset), &cpuset);
if (s != 0)
errc(EXIT_FAILURE, s, "pthread_setaffinity_np");
-
+\&
/* Check the actual affinity mask assigned to the thread. */
-
+\&
s = pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset);
if (s != 0)
errc(EXIT_FAILURE, s, "pthread_getaffinity_np");
-
+\&
printf("Set returned by pthread_getaffinity_np() contained:\en");
for (size_t j = 0; j < CPU_SETSIZE; j++)
if (CPU_ISSET(j, &cpuset))
printf(" CPU %zu\en", j);
-
+\&
exit(EXIT_SUCCESS);
}
.EE