#include <sched.h>
#include <pthread.h>
-#include <rte_config.h>
#include <rte_common.h>
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#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;
* 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);
printf("error on thread exit\n");
}
+ pthread_cond_destroy(&exit_cond);
+ pthread_mutex_destroy(&print_lock);
+ pthread_mutex_destroy(&exit_lock);
+
/* shutdown the lthread scheduler */
lthread_scheduler_shutdown(rte_lcore_id());
lthread_detach();