summaryrefslogtreecommitdiff
path: root/product/Service/Infrastructure/Threading/SynchronizedContext.cs
blob: 258c9eaac4c6a1a156f8c338ae7e07ae904efcfe (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
using System.Threading;
using Gorilla.Commons.Utility.Core;

namespace MoMoney.Service.Infrastructure.Threading
{
    public interface ISynchronizationContext : IParameterizedCommand<ICommand>
    {
    }

    public class SynchronizedContext : ISynchronizationContext
    {
        readonly SynchronizationContext context;

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

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