/src/Manos.IO/Manos.IO.Managed/CheckWatcher.cs
http://github.com/jacksonh/manos · C# · 31 lines · 25 code · 6 blank · 0 comment · 3 complexity · 3ef3c577bad050417001cc2fe3060998 MD5 · raw file
- using System;
- namespace Manos.IO.Managed
- {
- class CheckWatcher : Watcher, ICheckWatcher
- {
- private Action cb;
- public CheckWatcher (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);
- }
- }
- }