/src/Manos.IO/Manos.IO.Managed/IdleWatcher.cs
http://github.com/jacksonh/manos · C# · 31 lines · 25 code · 6 blank · 0 comment · 3 complexity · 66c5c0ccc1df1b979714e99160acb416 MD5 · raw file
- using System;
- namespace Manos.IO.Managed
- {
- class IdleWatcher : Watcher, IIdleWatcher
- {
- private Action cb;
- public IdleWatcher (Context context, Action callback)
- : base (context)
- {
- if (callback == null)
- throw new ArgumentNullException ("callback");
-
- this.cb = callback;
- }
- public void Invoke ()
- {
- if (IsRunning) {
- cb ();
- }
- }
- protected override void Dispose (bool disposing)
- {
- Context.Remove (this);
- }
- }
- }