3 * snmp_locking.h - multi-thread resource locking support declarations
6 * Author: Markku Laukkanen
9 * 8-Sep-1999 M. Slifcak method names changed;
10 * use array of resource locking structures.
11 * 3-Jan-2001 R. Story copy mt_resource.h to snmp_locking.h
14 #ifndef SNMP_LOCKING_H
15 #define SNMP_LOCKING_H
25 typedef pthread_mutex_t mutex_type;
26 #ifdef pthread_mutexattr_default
27 #define MT_MUTEX_INIT_DEFAULT pthread_mutexattr_default
29 #define MT_MUTEX_INIT_DEFAULT 0
32 #elif defined(WIN32) || defined(cygwin)
34 typedef CRITICAL_SECTION mutex_type;
36 error "There is no re-entrant support as defined."
37 #endif /* HAVE_PTHREAD_H */
39 int netsnmp_mutex_init(mutex_type *);
40 int netsnmp_mutex_lock(mutex_type *);
41 int netsnmp_mutex_unlock(mutex_type *);
42 int netsnmp_mutex_destroy_mutex(mutex_type *);
44 #else /* !NS_REENTRANT */
46 #define netsnmp_mutex_init(x) do {} while (0)
47 #define netsnmp_mutex_lock(x) do {} while (0)
48 #define netsnmp_mutex_unlock(x) do {} while (0)
49 #define netsnmp_mutex_destroy_mutex(x) do {} while (0)
51 #endif /* !NS_REENTRANT */
56 #endif /* SNMP_LOCKING_H */