{ class Thread_GL
{
public class Guarder : IDisposable
{
//---------------------------------------------------------------
//Member variable
//---------------------------------------------------------------
private System.Threading.Timer ThreadTimer;
private UInt16 count;
//private Watchdog wdg;
//---------------------------------------------------------------
//Member functions
//---------------------------------------------------------------
public void Start()
{
count = 0;
if (ThreadTimer == null)
{
//委派 MainFunction 每10秒執行一次
ThreadTimer = new System.Threading.Timer(new System.Threading.TimerCallback(Task), this, 1, 10 * 1000);//10秒
}
}
public void Stop()
{
if (ThreadTimer != null)
{
ThreadTimer.Dispose();
ThreadTimer = null;
}
}
~Guarder()
{
this.Dispose();
}
public void Dispose()
{
Stop();
GC.SuppressFinalize(this);
}
//依據各工作預定時間呼叫Working Thread
private void Task(object obj)
{
this.count++;
//[Updater]
//每10秒(1HR)檢查一次
if (this.count % 1 == 0)
{
}
}
}
}
}
沒有留言:
張貼留言