faultdetector.hpp
来自「最新的版本ACE-5.6.8,刚从外文网上搬下,与大家分享.」· HPP 代码 · 共 46 行
HPP
46 行
// file : ACE_TMCast/FaultDetector.hpp
// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
// cvs-id : $Id: FaultDetector.hpp 80826 2008-03-04 14:51:23Z wotte $
#include "Protocol.hpp"
namespace ACE_TMCast
{
class FaultDetector
{
public:
FaultDetector ()
: alone_ (true), silence_period_ (-1)
{
}
public:
class Failed {};
void
insync ()
{
if (alone_)
alone_ = false;
silence_period_ = 0;
}
void
outsync ()
{
if (!alone_ && ++silence_period_ >= Protocol::FATAL_SILENCE_FRAME)
{
// cerr << "Silence period has been passed." << endl;
// cerr << "Decalring the node failed." << endl;
throw Failed ();
}
}
private:
bool alone_; // true if we haven't heard from any members yet.
short silence_period_;
};
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?