aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/vapi/include
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/vapi/include')
-rw-r--r--hicn-plugin/vapi/include/vapi/vapi_safe.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/hicn-plugin/vapi/include/vapi/vapi_safe.h b/hicn-plugin/vapi/include/vapi/vapi_safe.h
new file mode 100644
index 000000000..df1114cde
--- /dev/null
+++ b/hicn-plugin/vapi/include/vapi/vapi_safe.h
@@ -0,0 +1,19 @@
+#ifndef VAPI_SAFE
+#include <vapi/vapi.h>
+#include <pthread.h>
+
+extern pthread_mutex_t *mutex;
+
+vapi_error_e vapi_connect_safe(vapi_ctx_t * vapi_ctx_ret, int async);
+
+vapi_error_e vapi_disconnect_safe();
+void vapi_lock();
+
+void vapi_unlock();
+
+#define VAPI_SAFE (NAME, res, ...) \
+ vapi_lock(); \
+ res = ## NAME (__ARGS__); \
+ vapi_unlock();
+
+#endif //VAPI_SAFE