📄 wdtw32.c
字号:
/***************************************************************** * * * wdtw32.c * * * * This file is a part of the eXtremeDB-HA Application Framework * * It demonstrates McObject High Availabitity support and * * explains how to work with it. * * * ***************************************************************** * Copyright (c) 2001-2006 McObject LLC * * All Rights Reserved * *****************************************************************//* * ++ * * PROJECT: Ha Framework * * SUBSYSTEM: HA support * * MODULE: wdtw32.c * * ABSTRACT: WATCHDOG asynchron processing procedures for HA support * * * VERSION: 1.0 * * HISTORY: * 1.0- 1 SS 19-Oct-2003 Created it was * * -- */#ifdef _WIN32#define _WIN32_WINNT 0x0500#include "app.h"#include "watchdog.h"static HANDLE timer;void WatchdogRoutine ( LPVOID lpArgToCompletionRoutine, uint4 dwTimerLowValue, uint4 dwTimerHighValue ){ ((MCO_PWATCHDOG)lpArgToCompletionRoutine)();}int mco_create_watchdog( long msec, MCO_PWATCHDOG proc){#ifdef CFG_SHARED_COMMIT FILETIME time; if( (timer = CreateWaitableTimer ( 0, // pointer to security attributes 0, // flag for manual reset state NULL // pointer to timer object name ) ) == NULL) return -1; time.dwHighDateTime = -1;//(msec/10000); time.dwLowDateTime = -(msec*10000); if( !SetWaitableTimer( timer, // handle to a timer object (const LARGE_INTEGER*)&time, // when timer will become signaled msec, // periodic timer interval (PTIMERAPCROUTINE)WatchdogRoutine, // completion routine (LPVOID) proc, // data for completion routine 0 // flag for resume state )) { CloseHandle( timer ); return -1; }#endif return 0;}void mco_kill_watchdog(){#ifdef CFG_SHARED_COMMIT CancelWaitableTimer( timer ); CloseHandle( timer );#endif}#endif /* _WIN32 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -