]> git.droids-corp.org - dpdk.git/commitdiff
examples/performance-thread: support C++
authorHiroki Shirokura <slank.dev@gmail.com>
Wed, 22 Mar 2017 02:26:23 +0000 (11:26 +0900)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 21 Apr 2017 00:39:05 +0000 (02:39 +0200)
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>
14 files changed:
examples/performance-thread/common/arch/x86/ctx.h
examples/performance-thread/common/lthread.h
examples/performance-thread/common/lthread_api.h
examples/performance-thread/common/lthread_cond.h
examples/performance-thread/common/lthread_diag.h
examples/performance-thread/common/lthread_diag_api.h
examples/performance-thread/common/lthread_int.h
examples/performance-thread/common/lthread_mutex.h
examples/performance-thread/common/lthread_objcache.h
examples/performance-thread/common/lthread_pool.h
examples/performance-thread/common/lthread_queue.h
examples/performance-thread/common/lthread_sched.h
examples/performance-thread/common/lthread_timer.h
examples/performance-thread/common/lthread_tls.h

index 03860508e9c1ac81f9db62c6b63945471680fde5..a41ce05a5f4d470792514b3f3002fbd01721c0f8 100644 (file)
 #ifndef CTX_H
 #define CTX_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * CPU context registers
  */
@@ -54,4 +58,8 @@ void
 ctx_switch(struct ctx *new_ctx, struct ctx *curr_ctx);
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* RTE_CTX_H_ */
index 8c77af82eeeb6379db6abeeb2964375010c0a912..5c2c1a5f0e5329a321558e211e4c0cad7f5bed80 100644 (file)
 #ifndef LTHREAD_H_
 #define LTHREAD_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <rte_per_lcore.h>
 
 #include "lthread_api.h"
@@ -96,4 +100,8 @@ _lthread_init(struct lthread *lt,
 
 void _lthread_set_stack(struct lthread *lt, void *stack, size_t stack_size);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif                         /* LTHREAD_H_ */
index ec976103f949e264a4cc0f72529b3b84cb5af136..ff245a0825e78af1c9c7b9ebe0a3c210cab52b59 100644 (file)
 #ifndef LTHREAD_H
 #define LTHREAD_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdint.h>
 #include <sys/socket.h>
 #include <fcntl.h>
@@ -829,4 +833,8 @@ int lthread_cond_signal(struct lthread_cond *c);
   */
 int lthread_cond_broadcast(struct lthread_cond *c);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif                         /* LTHREAD_H */
index 5bd02a7dcb46a6a5a52d5533cd06ed92dc51e4c9..5e5f14be95b9c9c657b904e9f143742569ad0b13 100644 (file)
 #ifndef LTHREAD_COND_H_
 #define LTHREAD_COND_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "lthread_queue.h"
 
 #define MAX_COND_NAME_SIZE 64
@@ -74,4 +78,8 @@ struct lthread_cond {
        uint64_t diag_ref;      /* optional ref to user diag data */
 } __rte_cache_aligned;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif                         /* LTHREAD_COND_H_ */
index 2877d311c58b84a6413d60c0478eb6025bd1baa0..3dce8e0eb9fa62b3c6bb5d0157816002280f3ed4 100644 (file)
 #ifndef LTHREAD_DIAG_H_
 #define LTHREAD_DIAG_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdint.h>
 #include <inttypes.h>
 
@@ -129,4 +133,9 @@ extern uint64_t diag_mask;
 #define DIAG_USED __rte_unused
 
 #endif                         /* LTHREAD_DIAG */
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif                         /* LTHREAD_DIAG_H_ */
index 7ee514f8bbdb1c8a9c962b441de0826eaf04b59e..2fda0951fe187010f204d8bf8bf7565ebf4de2f5 100644 (file)
 #ifndef LTHREAD_DIAG_API_H_
 #define LTHREAD_DIAG_API_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdint.h>
 #include <inttypes.h>
 
@@ -322,4 +326,8 @@ lthread_cond_diag_ref(struct lthread_cond *c);
 uint64_t
 lthread_mutex_diag_ref(struct lthread_mutex *m);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif                         /* LTHREAD_DIAG_API_H_ */
index 031d8afc486f13ff2eb3e55383bdfe01f54670fc..3f7fb92dfb4408adf460ebc12e5c3fff9c245413 100644 (file)
 #include <lthread_api.h>
 #define LTHREAD_INT_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdint.h>
 #include <sys/time.h>
 #include <sys/types.h>
@@ -197,4 +201,8 @@ struct lthread {
        uint64_t diag_ref;                      /* ref to user diag data */
 } __rte_cache_aligned;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif                         /* LTHREAD_INT_H */
index 4d30b2e7191485a0e9052abf767d41a40f567a1e..e78db91dc28123eefcd1096c59ca7d03474906c3 100644 (file)
 #ifndef LTHREAD_MUTEX_H_
 #define LTHREAD_MUTEX_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "lthread_queue.h"
 
 
@@ -49,4 +53,8 @@ struct lthread_mutex {
        uint64_t                diag_ref; /* optional ref to user diag data */
 } __rte_cache_aligned;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LTHREAD_MUTEX_H_ */
index d7e35825f501ae8a4d4c87cc04a34421098eaaa1..6e5195ba5453005eac94fbac55c9487aee902015 100644 (file)
 #ifndef LTHREAD_OBJCACHE_H_
 #define LTHREAD_OBJCACHE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <string.h>
 
 #include <rte_per_lcore.h>
@@ -154,5 +158,8 @@ _lthread_objcache_free(struct lthread_objcache *c, void *obj)
 }
 
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif                         /* LTHREAD_OBJCACHE_H_ */
index 27680eab97c76e5887f6c7ffdedbc2a6f8e6f73d..fb0c578b039819e9b2ca72982358e3f0a4df4adc 100644 (file)
 #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>
@@ -328,5 +332,8 @@ _qnode_pool_destroy(struct qnode_pool *p)
        return 0;
 }
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif                         /* LTHREAD_POOL_H_ */
index 2c55fcec72828851c82656a2a329dd39f21054b1..4fc2074e42481c25e4ac930dd2dc668446d3d13e 100644 (file)
 #ifndef LTHREAD_QUEUE_H_
 #define LTHREAD_QUEUE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <string.h>
 
 #include <rte_prefetch.h>
@@ -298,5 +302,8 @@ _lthread_queue_remove(struct lthread_queue *q)
        return NULL;
 }
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif                         /* LTHREAD_QUEUE_H_ */
index 4ce56c27cbcb3058fba0d0c04c66429237dc4b7a..7cddda9c588d80bde3c3ed2617ed0a0c80f9faec 100644 (file)
 #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"
@@ -148,5 +152,8 @@ extern struct lthread_sched *schedcore[];
 void _sched_timer_cb(struct rte_timer *tim, void *arg);
 void _sched_shutdown(__rte_unused void *arg);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif                         /* LTHREAD_SCHED_H_ */
index b5e6fb0efc1915b0c25b1dac82bf2ddc5447b8da..b044b902b1e1c24be22c1fb6ad0a2dc5e3861637 100644 (file)
 #ifndef LTHREAD_TIMER_H_
 #define LTHREAD_TIMER_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "lthread_int.h"
 #include "lthread_sched.h"
 
@@ -75,5 +79,8 @@ _timer_stop(struct lthread *lt)
        }
 }
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* LTHREAD_TIMER_H_ */
index 86cbfadcc253d178225a2d41e122bb8b889d489d..fff3c0db8ac85ddb92db35b37f869610b089b8b3 100644 (file)
 #ifndef LTHREAD_TLS_H_
 #define LTHREAD_TLS_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "lthread_api.h"
 
 #define RTE_PER_LTHREAD_SECTION_SIZE \
@@ -53,5 +57,8 @@ void _lthread_tls_destroy(struct lthread *lt);
 void _lthread_key_pool_init(void);
 void _lthread_tls_alloc(struct lthread *lt);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif                         /* LTHREAD_TLS_H_ */