Lthread is awesome but it doesn't support C++.
So I write patch to support lthread to support C++.
Added "extern C {}" to lthread-headers
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
#ifndef CTX_H
#define CTX_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* CPU context registers
*/
ctx_switch(struct ctx *new_ctx, struct ctx *curr_ctx);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* RTE_CTX_H_ */
#ifndef LTHREAD_H_
#define LTHREAD_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <rte_per_lcore.h>
#include "lthread_api.h"
void _lthread_set_stack(struct lthread *lt, void *stack, size_t stack_size);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LTHREAD_H_ */
#ifndef LTHREAD_H
#define LTHREAD_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdint.h>
#include <sys/socket.h>
#include <fcntl.h>
*/
int lthread_cond_broadcast(struct lthread_cond *c);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LTHREAD_H */
#ifndef LTHREAD_COND_H_
#define LTHREAD_COND_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "lthread_queue.h"
#define MAX_COND_NAME_SIZE 64
uint64_t diag_ref; /* optional ref to user diag data */
} __rte_cache_aligned;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LTHREAD_COND_H_ */
#ifndef LTHREAD_DIAG_H_
#define LTHREAD_DIAG_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdint.h>
#include <inttypes.h>
#define DIAG_USED __rte_unused
#endif /* LTHREAD_DIAG */
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LTHREAD_DIAG_H_ */
#ifndef LTHREAD_DIAG_API_H_
#define LTHREAD_DIAG_API_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdint.h>
#include <inttypes.h>
uint64_t
lthread_mutex_diag_ref(struct lthread_mutex *m);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LTHREAD_DIAG_API_H_ */
#include <lthread_api.h>
#define LTHREAD_INT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdint.h>
#include <sys/time.h>
#include <sys/types.h>
uint64_t diag_ref; /* ref to user diag data */
} __rte_cache_aligned;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LTHREAD_INT_H */
#ifndef LTHREAD_MUTEX_H_
#define LTHREAD_MUTEX_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "lthread_queue.h"
uint64_t diag_ref; /* optional ref to user diag data */
} __rte_cache_aligned;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LTHREAD_MUTEX_H_ */
#ifndef LTHREAD_OBJCACHE_H_
#define LTHREAD_OBJCACHE_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <string.h>
#include <rte_per_lcore.h>
}
+#ifdef __cplusplus
+}
+#endif
#endif /* LTHREAD_OBJCACHE_H_ */
#ifndef LTHREAD_POOL_H_
#define LTHREAD_POOL_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <rte_malloc.h>
#include <rte_per_lcore.h>
#include <rte_log.h>
return 0;
}
+#ifdef __cplusplus
+}
+#endif
#endif /* LTHREAD_POOL_H_ */
#ifndef LTHREAD_QUEUE_H_
#define LTHREAD_QUEUE_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <string.h>
#include <rte_prefetch.h>
return NULL;
}
+#ifdef __cplusplus
+}
+#endif
#endif /* LTHREAD_QUEUE_H_ */
#ifndef LTHREAD_SCHED_H_
#define LTHREAD_SCHED_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "lthread_int.h"
#include "lthread_queue.h"
#include "lthread_objcache.h"
void _sched_timer_cb(struct rte_timer *tim, void *arg);
void _sched_shutdown(__rte_unused void *arg);
+#ifdef __cplusplus
+}
+#endif
#endif /* LTHREAD_SCHED_H_ */
#ifndef LTHREAD_TIMER_H_
#define LTHREAD_TIMER_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "lthread_int.h"
#include "lthread_sched.h"
}
}
+#ifdef __cplusplus
+}
+#endif
#endif /* LTHREAD_TIMER_H_ */
#ifndef LTHREAD_TLS_H_
#define LTHREAD_TLS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "lthread_api.h"
#define RTE_PER_LTHREAD_SECTION_SIZE \
void _lthread_key_pool_init(void);
void _lthread_tls_alloc(struct lthread *lt);
+#ifdef __cplusplus
+}
+#endif
#endif /* LTHREAD_TLS_H_ */