diff options
Diffstat (limited to 'lib/infrastructure/threading/WorkerThread.cs')
| -rw-r--r--[-rwxr-xr-x] | lib/infrastructure/threading/WorkerThread.cs | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/lib/infrastructure/threading/WorkerThread.cs b/lib/infrastructure/threading/WorkerThread.cs index 4650d96..ca4f08e 100755..100644 --- a/lib/infrastructure/threading/WorkerThread.cs +++ b/lib/infrastructure/threading/WorkerThread.cs @@ -1,50 +1,50 @@ -using System;
-using System.ComponentModel;
-using gorilla.infrastructure.logging;
-
-namespace gorilla.infrastructure.threading +using System; +using System.ComponentModel; +using jive.infrastructure.logging; + +namespace jive.infrastructure.threading { - public class WorkerThread : Component, IWorkerThread - { - static readonly object do_work_key = new object(); - bool is_running; - readonly Action background_thread; + public class WorkerThread : Component, IWorkerThread + { + static readonly object do_work_key = new object(); + bool is_running; + readonly Action background_thread; - public WorkerThread() - { - background_thread = worker_thread_start; - } + public WorkerThread() + { + background_thread = worker_thread_start; + } - public event DoWorkEventHandler DoWork - { - add { Events.AddHandler(do_work_key, value); } - remove { Events.RemoveHandler(do_work_key, value); } - } + public event DoWorkEventHandler DoWork + { + add { Events.AddHandler(do_work_key, value); } + remove { Events.RemoveHandler(do_work_key, value); } + } - public void begin() - { - if (is_running) - { - throw new InvalidOperationException("Worker Thread Is Already Running"); - } - is_running = true; - background_thread.BeginInvoke(null, null); - } + public void begin() + { + if (is_running) + { + throw new InvalidOperationException("Worker Thread Is Already Running"); + } + is_running = true; + background_thread.BeginInvoke(null, null); + } - void worker_thread_start() + void worker_thread_start() + { + try + { + var handler = (DoWorkEventHandler) Events[do_work_key]; + if (handler != null) { - try - { - var handler = (DoWorkEventHandler) Events[do_work_key]; - if (handler != null) - { - handler(this, new DoWorkEventArgs(null)); - } - } - catch (Exception e) - { - this.log().error(e); - } + handler(this, new DoWorkEventArgs(null)); } + } + catch (Exception e) + { + this.log().error(e); + } } -}
\ No newline at end of file + } +} |
