summaryrefslogtreecommitdiffstats
path: root/examples/performance-thread/pthread_shim/main.c
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2017-06-08 09:46:51 -0600
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2017-06-08 09:51:02 -0600
commitaab0c291a90f701b60f8c9a88cbcc265cba0ec8b (patch)
treebfa7bf9663cb9a518d81f18e3a2c792eee8fa1c8 /examples/performance-thread/pthread_shim/main.c
parentce3d555e43e3795b5d9507fcfc76b7a0a92fd0d6 (diff)
Imported Upstream version 16.11.2
Change-Id: I947038e46a2c747296dc7aa7522239733ca2f659 Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'examples/performance-thread/pthread_shim/main.c')
-rw-r--r--examples/performance-thread/pthread_shim/main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c
index f0357218..850b009d 100644
--- a/examples/performance-thread/pthread_shim/main.c
+++ b/examples/performance-thread/pthread_shim/main.c
@@ -59,6 +59,10 @@
#define DEBUG_APP 0
#define HELLOW_WORLD_MAX_LTHREADS 10
+#ifndef __GLIBC__ /* sched_getcpu() is glibc-specific */
+#define sched_getcpu() rte_lcore_id()
+#endif
+
__thread int print_count;
__thread pthread_mutex_t print_lock;
@@ -175,12 +179,12 @@ static void initial_lthread(void *args __attribute__((unused)))
* use an attribute to pass the desired lcore
*/
pthread_attr_t attr;
- cpu_set_t cpuset;
+ rte_cpuset_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(lcore, &cpuset);
pthread_attr_init(&attr);
- pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset);
+ pthread_attr_setaffinity_np(&attr, sizeof(rte_cpuset_t), &cpuset);
/* create the thread */
pthread_create(&tid[i], &attr, helloworld_pthread, (void *) i);