📄 glbsem.h
字号:
#define S_UNLOCK_COMMON_RESOURCES()#define S_LOCK_RESOURCES()#define S_UNLOCK_RESOURCES()#endif/************************************************************************/#define MAX_SEM_NEST_TRACK 20 extern ST_UINT gs_track; /* This variable when set to value >0 */ /* during an application startup allows */ /* tracking of MUTEX or EVENT sem. */extern ST_INT gs_currSemOwnerIndex;extern ST_CHAR gs_currSemOwnerFile[MAX_SEM_NEST_TRACK][SLOG_MAX_FNAME+1];extern ST_INT gs_currSemOwnerLine[MAX_SEM_NEST_TRACK];extern ST_DOUBLE gs_hwMutexTime;extern ST_DOUBLE gs_hwEventTime; /*---*---*---*---*---*---*---*---*---*---*---*---*---*--*/ /* */ /* Timer functions */ /* */ /*---*---*---*---*---*---*---*---*---*---*---*---*---*--*/#if defined (_WIN32) || defined (_AIX) || (defined(__alpha) && !defined(__VMS)) /* Note: On AIX the real-time support is not implemented. */ /* Functions such as timer_create, sleep, or nanosleep are*/ /* not available (in AIX version 4.3.2 or 4.3.3). */ /* This implementation of timers is using the GLBSEM */ /* gs_wait_event_sem function implemented with phtreads */ /* to support the timer functionality. *//* The timer support will be initialized automatically when the function*//* gs_timer_start is called for the first time. *//* If the timer is of type SD_TIMER_ONESHOT then the timer resources *//* will be automatically deleted after the first time the timer is *//* serviced. For the SD_TIMER_PERIODIC timer the user needs to call *//* the gs_timer_end function to stop the timer and release resources. *//* Before application exits the function gs_timer_cleanup should be *//* called to cleanup all resources associates with timers. */#define SD_TIMER_ONESHOT 1#define SD_TIMER_PERIODIC 2struct gs_timer_tag; /* forward definition */typedef struct gs_timer_tag {#if defined (_WIN32) UINT timerID; /* timer id returned from timeSetEvent */ ST_BOOLEAN pending; /* shows if timer processing is already pending */ ST_DOUBLE delay_start; /* time when delete timer delay started */#endif struct gs_timer_tag *next; /* pointer to next element in list */ struct gs_timer_tag *prev; /* pointer to prev element in list */ ST_ULONG interval; /* milliseconds, time between servicing */ ST_ULONG elapsed; /* milliseconds, time elapsed in sleep */ ST_UINT type; /* timer type: oneshot or periodic */ ST_VOID (*callback_fun)(ST_VOID *); ST_VOID *arg; /* argument for the callback_fun. */ } GS_TIMER;/* The timer resolution could be set to the lowest value required by an *//* application before calling the gs_timer_start function. *//* On Windows system if the timer resolution is changed while the *//* application is running, only timers started afterwards will be *//* affected. On UNIX system all timers will be afected. */ST_RET gs_timer_init (ST_VOID);ST_RET gs_timer_set_resolution (ST_ULONG timer_resolution);ST_ULONG gs_timer_get_resolution (ST_VOID);GS_TIMER *gs_timer_start (ST_UINT type, ST_ULONG interval, ST_VOID (*callback_fun)(ST_VOID *), ST_VOID *arg);ST_RET gs_timer_end (GS_TIMER *timer_id);ST_RET gs_timer_cleanup (ST_VOID);#endif /* defined (_WIN32) || defined (_AIX) || (defined(__alpha) && !defined(__VMS)) *//************************************************************************//* Logging macro's used internally by glbsem.c */#if defined(DEBUG_SISCO) #define GLBSEM_LOG_ERR0(a) {\ if (gs_debug_sel & GS_LOG_ERR)\ _slog (sLogCtrl, _glbem_err_logstr,\ thisFileName,__LINE__,a);\ }#define GLBSEM_LOG_ERR1(a,b) {\ if (gs_debug_sel & GS_LOG_ERR)\ _slog (sLogCtrl, _glbem_err_logstr,\ thisFileName,__LINE__,a,b);\ }#define GLBSEM_LOG_ERR2(a,b,c) {\ if (gs_debug_sel & GS_LOG_ERR)\ _slog (sLogCtrl, _glbem_err_logstr,\ thisFileName,__LINE__,a,b,c);\ }#define GLBSEM_LOG_ERR3(a,b,c,d) {\ if (gs_debug_sel & GS_LOG_ERR)\ _slog (sLogCtrl, _glbem_err_logstr,\ thisFileName,__LINE__,a,b,c,d);\ }#define GLBSEM_LOG_CERR0(a) {\ if (gs_debug_sel & GS_LOG_ERR)\ _slogc (sLogCtrl,a);\ }#define GLBSEM_LOG_CERR1(a,b) {\ if (gs_debug_sel & GS_LOG_ERR)\ _slogc (sLogCtrl,a,b);\ }#define GLBSEM_LOG_CERR2(a,b,c) {\ if (gs_debug_sel & GS_LOG_ERR)\ _slogc (sLogCtrl,a,b,c);\ }#define GLBSEM_LOG_CERR3(a,b,c,d) {\ if (gs_debug_sel & GS_LOG_ERR)\ _slogc (sLogCtrl,a,b,c,d);\ }#define GLBSEM_LOG_NERR0(a) {\ if (gs_debug_sel & GS_LOG_NERR)\ _slog (sLogCtrl, _glbem_nerr_logstr,\ thisFileName,__LINE__,a);\ }#define GLBSEM_LOG_NERR1(a,b) {\ if (gs_debug_sel & GS_LOG_NERR)\ _slog (sLogCtrl, _glbem_nerr_logstr,\ thisFileName,__LINE__,a,b);\ }#define GLBSEM_LOG_NERR2(a,b,c) {\ if (gs_debug_sel & GS_LOG_NERR)\ _slog (sLogCtrl, _glbem_nerr_logstr,\ thisFileName,__LINE__,a,b,c);\ }#define GLBSEM_LOG_NERR3(a,b,c,d) {\ if (gs_debug_sel & GS_LOG_NERR)\ _slog (sLogCtrl, _glbem_nerr_logstr,\ thisFileName,__LINE__,a,b,c,d);\ }#define GLBSEM_LOG_ALWAYS0(a) {\ _slog (sLogCtrl, _glbem_always_logstr,\ thisFileName,__LINE__,a);\ }#define GLBSEM_LOG_ALWAYS1(a,b) {\ _slog (sLogCtrl, _glbem_always_logstr,\ thisFileName,__LINE__,a,b);\ }#define GLBSEM_LOG_ALWAYS2(a,b,c) {\ _slog (sLogCtrl, _glbem_always_logstr,\ thisFileName,__LINE__,a,b,c);\ }#define GLBSEM_LOG_ALWAYS3(a,b,c,d) {\ _slog (sLogCtrl, _glbem_always_logstr,\ thisFileName,__LINE__,a,b,c,d);\ }#define GLBSEM_LOG_CALWAYS0(a) {\ _slogc (sLogCtrl,a);\ }#define GLBSEM_LOG_CALWAYS1(a,b) {\ _slogc (sLogCtrl,a,b);\ }#define GLBSEM_LOG_CALWAYS2(a,b,c) {\ _slogc (sLogCtrl,a,b,c);\ }#define GLBSEM_LOG_CALWAYS3(a,b,c,d) {\ _slogc (sLogCtrl,a,b,c,d);\ }#define GLBSEM_LOG_FLOW0(a) {\ if (gs_debug_sel & GS_LOG_FLOW)\ _slog (sLogCtrl, _glbem_flow_logstr,\ thisFileName,__LINE__,a);\ }#define GLBSEM_LOG_FLOW1(a,b) {\ if (gs_debug_sel & GS_LOG_FLOW)\ _slog (sLogCtrl, _glbem_flow_logstr,\ thisFileName,__LINE__,a,b);\ }#define GLBSEM_LOG_FLOW2(a,b,c) {\ if (gs_debug_sel & GS_LOG_FLOW)\ _slog (sLogCtrl, _glbem_flow_logstr,\ thisFileName,__LINE__,a,b,c);\ }#define GLBSEM_LOG_FLOW3(a,b,c,d) {\ if (gs_debug_sel & GS_LOG_FLOW)\ _slog (sLogCtrl, _glbem_flow_logstr,\ thisFileName,__LINE__,a,b,c,d);\ }#define GLBSEM_LOG_CFLOW0(a) {\ if (gs_debug_sel & GS_LOG_FLOW)\ _slogc (sLogCtrl,a);\ }#define GLBSEM_LOG_CFLOW1(a,b) {\ if (gs_debug_sel & GS_LOG_FLOW)\ _slogc (sLogCtrl,a,b);\ }#define GLBSEM_LOG_CFLOW2(a,b,c) {\ if (gs_debug_sel & GS_LOG_FLOW)\ _slogc (sLogCtrl,a,b,c);\ }#define GLBSEM_LOG_CFLOW3(a,b,c,d) {\ if (gs_debug_sel & GS_LOG_FLOW)\ _slogc (sLogCtrl,a,b,c,d);\ }#else /* No DEBUG_SISCO */#define GLBSEM_LOG_ERR0(a)#define GLBSEM_LOG_ERR1(a,b)#define GLBSEM_LOG_ERR2(a,b,c)#define GLBSEM_LOG_ERR3(a,b,c,d)#define GLBSEM_LOG_CERR0(a)#define GLBSEM_LOG_CERR1(a,b)#define GLBSEM_LOG_CERR2(a,b,c)#define GLBSEM_LOG_CERR3(a,b,c,d)#define GLBSEM_LOG_NERR0(a)#define GLBSEM_LOG_NERR1(a,b)#define GLBSEM_LOG_NERR2(a,b,c)#define GLBSEM_LOG_NERR3(a,b,c,d)#define GLBSEM_LOG_ALWAYS0(a)#define GLBSEM_LOG_ALWAYS1(a,b)#define GLBSEM_LOG_ALWAYS2(a,b,c)#define GLBSEM_LOG_ALWAYS3(a,b,c,d)#define GLBSEM_LOG_CALWAYS0(a)#define GLBSEM_LOG_CALWAYS1(a,b)#define GLBSEM_LOG_CALWAYS2(a,b,c)#define GLBSEM_LOG_CALWAYS3(a,b,c,d)#define GLBSEM_LOG_FLOW0(a)#define GLBSEM_LOG_FLOW1(a,b)#define GLBSEM_LOG_FLOW2(a,b,c)#define GLBSEM_LOG_FLOW3(a,b,c,d)#define GLBSEM_LOG_CFLOW0(a)#define GLBSEM_LOG_CFLOW1(a,b)#define GLBSEM_LOG_CFLOW2(a,b,c)#define GLBSEM_LOG_CFLOW3(a,b,c,d)#endif/************************************************************************/#define gs_install() /* OBSOLETE: for backward compat. only */#define S_GS_INSTALL() /* OBSOLETE: for backward compat. only. */#define S_GS_INIT() /* OBSOLETE: for backward compat. only. *//************************************************************************//************************************************************************//************************************************************************//* Digital UNIX *//* We have implemented POSIX 1003.1b functions to use additional *//* realtime user signals available on Digital UNIX (but not on AIX). *//* These functions may be used if user application like to use signals *//* other then the SIGUSR1 or SIGUSR2. *//************************************************************************/#if defined(__alpha) && !defined(__VMS)#include <signal.h>typedef struct gs_signal_tag { sigset_t set; int sig_num; } GS_SIGNAL;#define ST_USR_SIG GS_SIGNAL#define ST_PID pid_tST_USR_SIG *gs_get_sig (ST_INT sig_num);ST_RET gs_wait_sig (ST_USR_SIG *us, ST_LONG timeout);ST_RET gs_raise_sig (ST_USR_SIG *us, ST_PID pid);ST_RET gs_free_sig (ST_USR_SIG *us);#endif /* defined(__alpha) && !defined(__VMS) */#ifdef __cplusplus}#endif#endif /* #ifndef GBLSEM_INCLUDED */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -