summaryrefslogtreecommitdiff
path: root/lib/infrastructure/threading/SynchronizedContext.cs
blob: 9cd15cd68d0402f4c28f5ab23bd3f642a6282233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System.Threading;
using jive.utility;

namespace jive.infrastructure.threading
{
  public interface ISynchronizationContext : Command<Command> {}

  public class SynchronizedContext : ISynchronizationContext
  {
    readonly SynchronizationContext context;

    public SynchronizedContext(SynchronizationContext context)
    {
      this.context = context;
    }

    public void run(Command item)
    {
      context.Post(x => item.run(), new object());
      //context.Send(x => item.run(), new object());
    }
  }
}