aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/vapi/include/vapi/vapi_safe.h
blob: df1114cde577c8eaabdfbaa816c87580ff76f6b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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