⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wdtint.c

📁 extremeDB s sample code,useful for you
💻 C
字号:
/***************************************************************** *                                                               * *  wdtint.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:    wdtint.c * * ABSTRACT:  WATCHDOG asynchron processing procedures for HA support * * * VERSION:   1.0 * * HISTORY: *            1.0- 1 AK     31-Jan-2005 Created * * -- */#if defined(_INTEGRITY)#include   <INTEGRITY.h>#include   "watchdog.h"Clock	wdtClock;Task 	wdtTask;void    wdt_thread_proc( void ) {	MCO_PWATCHDOG proc;	Task task=CurrentTask();	GetTaskIdentification( task, (Value *) & proc );	for (;;) {		SynchronousReceive( (Connection)wdtClock, NULL );		proc();		};};int mco_create_watchdog( long msec, MCO_PWATCHDOG proc){	Time T;	Value P,W;	if ( Success != CreateVirtualClock( PrimaryClock, CLOCK_ALL, &wdtClock ) ) 		return 1;		T.Seconds = msec/1000;	T.Fraction = msec - 1000*T.Seconds;	if ( Success != SetClockAlarm( PrimaryClock, true, NULLTime, &T ) ) {		CloseClock( wdtClock );		return 1;	};	GetPriorityAndWeight(CurrentTask(),&P,&W);	CommonCreateTask( 1, (Address)wdt_thread_proc, 0x1000, "An mco watchdog", &wdtTask);	SetPriorityAndWeight( wdtTask, P, W, true);	SetTaskIdentification( wdtTask, (Value)proc );	RunTask( wdtTask );	        return Success == RunTask( wdtTask ) ? 0 : 1 ;}void mco_kill_watchdog( long msec, MCO_PWATCHDOG proc){	CommonCloseTask( wdtTask );	CloseClock( wdtClock );}#endif /* defined(_INTEGRITY) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -