00001 #pragma once
00002 #ifndef _PROBE_API_H
00003 #define _PROBE_API_H
00004
00005 #include "public/probe-api.h"
00006 #include "probe-cache.h"
00007
00012 struct id_desc_t {
00013 #ifndef HAVE_ATOMIC_FUNCTIONS
00014 pthread_mutex_t item_id_ctr_lock;
00015 #endif
00016 int item_id_ctr;
00017 };
00018
00020 typedef struct {
00021
00022 SEAP_CTX_t *ctx;
00023 int sd;
00024
00025
00026 pcache_t *pcache;
00027 pthread_rwlock_t pcache_lock;
00028
00029 struct id_desc_t id_desc;
00030
00031
00032 void *probe_arg;
00033 } globals_t;
00034
00036 extern globals_t global;
00037
00038 #if defined(HAVE_ATOMIC_FUNCTIONS)
00039 #define GLOBALS_INITIALIZER { NULL, -1, NULL, PTHREAD_RWLOCK_INITIALIZER, {1}, NULL }
00040 #else
00041 #define GLOBALS_INITIALIZER { NULL, -1, NULL, PTHREAD_RWLOCK_INITIALIZER, {PTHREAD_MUTEX_INITIALIZER, 1}, NULL }
00042 #endif
00043
00044 #define READER_LOCK_CACHE pthread_rwlock_rdlock (&globals.pcache_lock)
00045 #define WRITER_LOCK_CACHE pthread_rwlock_wrlock (&globals.pcache_lock)
00046 #define READER_UNLOCK_CACHE pthread_rwlock_unlock (&globals.pcache_lock)
00047 #define WRITER_UNLOCK_CACHE pthread_rwlock_unlock (&globals.pcache_lock)
00048
00049 #define SEAP_LOCK pthread_mutex_lock (&globals.seap_lock)
00050 #define SEAP_UNLOCK pthread_mutex_unlock (&globals.seap_lock)
00051
00052 #endif