blob: 98ca9bb2d4d82bcd8c158b886501bdbb01e532c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
namespace jive
{
public class WorkderBackgroundThread : BackgroundThread
{
readonly IWorkerThread worker_thread;
public WorkderBackgroundThread(DisposableCommand command_to_execute) : this(command_to_execute, new WorkerThread()) {}
public WorkderBackgroundThread(DisposableCommand command_to_execute, IWorkerThread worker_thread)
{
this.worker_thread = worker_thread;
worker_thread.DoWork += (sender, e) => command_to_execute.run();
worker_thread.Disposed += (sender, e) => command_to_execute.Dispose();
}
public void run()
{
worker_thread.begin();
}
public void Dispose()
{
worker_thread.Dispose();
}
}
}
|