Main Page   Modules   Data Structures   File List   Data Fields   Examples  

snmp_locking.h

00001 
00002 /*
00003  * snmp_locking.h - multi-thread resource locking support declarations 
00004  */
00005 /*
00006  * Author: Markku Laukkanen
00007  * Created: 6-Sep-1999
00008  * History:
00009  *  8-Sep-1999 M. Slifcak method names changed;
00010  *                        use array of resource locking structures.
00011  *  3-Jan-2001 R. Story   copy mt_resource.h to snmp_locking.h
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  /*  HAVE_PTHREAD_H  */
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                           /* !NS_REENTRANT */
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                          /* !NS_REENTRANT */
00052 
00053 #ifdef __cplusplus
00054 }
00055 #endif
00056 #endif /*  SNMP_LOCKING_H  */


Generated on Tue Feb 24 13:35:24 2004 for net-snmp by doxygen1.3