00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef SNMP_LOCKING_H
00015 #define SNMP_LOCKING_H
00016
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020
00021 #ifdef NS_REENTRANT
00022
00023 #if HAVE_PTHREAD_H
00024 #include <pthread.h>
00025 typedef pthread_mutex_t mutex_type;
00026 #ifdef pthread_mutexattr_default
00027 #define MT_MUTEX_INIT_DEFAULT pthread_mutexattr_default
00028 #else
00029 #define MT_MUTEX_INIT_DEFAULT 0
00030 #endif
00031
00032 #elif defined(WIN32) || defined(cygwin)
00033 #include <windows.h>
00034 typedef CRITICAL_SECTION mutex_type;
00035 #else
00036 error "There is no re-entrant support as defined."
00037 #endif
00038
00039 int netsnmp_mutex_init(mutex_type *);
00040 int netsnmp_mutex_lock(mutex_type *);
00041 int netsnmp_mutex_unlock(mutex_type *);
00042 int netsnmp_mutex_destroy_mutex(mutex_type *);
00043
00044 #else
00045
00046 #define netsnmp_mutex_init(x) do {} while (0)
00047 #define netsnmp_mutex_lock(x) do {} while (0)
00048 #define netsnmp_mutex_unlock(x) do {} while (0)
00049 #define netsnmp_mutex_destroy_mutex(x) do {} while (0)
00050
00051 #endif
00052
00053 #ifdef __cplusplus
00054 }
00055 #endif
00056 #endif