blob: 2da6671800eeab075356953c27b82935772f63c8 (
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
27
28
|
using System;
using System.Threading;
using jive.utility;
namespace jive.infrastructure.threading
{
public interface ISynchronizedCommand : Command<Action>, Command<Command> {}
public class SynchronizedCommand : ISynchronizedCommand
{
readonly SynchronizationContext context;
public SynchronizedCommand(SynchronizationContext context)
{
this.context = context;
}
public void run(Action item)
{
context.Post(x => item(), new object());
}
public void run(Command item)
{
run(item.run);
}
}
}
|