mt_support.h

00001 /*
00002  * mt_support.h - multi-thread resource locking support declarations 
00003  */
00004 /*
00005  * Author: Markku Laukkanen
00006  * Created: 6-Sep-1999
00007  * History:
00008  *  8-Sep-1999 M. Slifcak method names changed;
00009  *                        use array of resource locking structures.
00010  */
00011 
00012 #ifndef MT_SUPPORT_H
00013 #define MT_SUPPORT_H
00014 
00015 #ifdef __cplusplus
00016 extern          "C" {
00017 #endif
00018   
00019 /*
00020  * Lock group identifiers 
00021  */
00022 
00023 #define MT_LIBRARY_ID      0
00024 #define MT_APPLICATION_ID  1
00025 #define MT_TOKEN_ID        2
00026 
00027 #define MT_MAX_IDS         3    /* one greater than last from above */
00028 #define MT_MAX_SUBIDS      10
00029 
00030 
00031 /*
00032  * Lock resource identifiers for library resources 
00033  */
00034 
00035 #define MT_LIB_NONE        0
00036 #define MT_LIB_SESSION     1
00037 #define MT_LIB_REQUESTID   2
00038 #define MT_LIB_MESSAGEID   3
00039 #define MT_LIB_SESSIONID   4
00040 #define MT_LIB_TRANSID     5
00041 
00042 #define MT_LIB_MAXIMUM     6    /* must be one greater than the last one */
00043 
00044 
00045 #if defined(NS_REENTRANT) || defined(WIN32)
00046 
00047 #if HAVE_PTHREAD_H
00048 #include <pthread.h>
00049 typedef pthread_mutex_t mutex_type;
00050 #ifdef pthread_mutexattr_default
00051 #define MT_MUTEX_INIT_DEFAULT pthread_mutexattr_default
00052 #else
00053 #define MT_MUTEX_INIT_DEFAULT 0
00054 #endif
00055 
00056 #elif defined(WIN32) || defined(cygwin)
00057 
00058 #include <windows.h>
00059 typedef CRITICAL_SECTION mutex_type;
00060 
00061 #else  /*  HAVE_PTHREAD_H  */
00062 error "There is no re-entrant support as defined."
00063 #endif /*  HAVE_PTHREAD_H  */
00064 
00065 
00066 int             snmp_res_init(void);
00067 int             snmp_res_lock(int groupID, int resourceID);
00068 int             snmp_res_unlock(int groupID, int resourceID);
00069 int             snmp_res_destroy_mutex(int groupID, int resourceID);
00070 
00071 #else /*  NS_REENTRANT  */
00072 
00073 #ifndef WIN32
00074 #define snmp_res_init() do {} while (0)
00075 #define snmp_res_lock(x,y) do {} while (0)
00076 #define snmp_res_unlock(x,y) do {} while (0)
00077 #define snmp_res_destroy_mutex(x,y) do {} while (0)
00078 #endif /*  WIN32  */
00079 
00080 #endif /*  NS_REENTRANT  */
00081 
00082 #ifdef __cplusplus
00083 }
00084 #endif
00085 #endif /*  MT_SUPPORT_H  */

net-snmpに対してSat Sep 5 13:14:22 2009に生成されました。  doxygen 1.4.7