当前位置: 首页>>代码示例>>C#>>正文


C# IScheduler.Post方法代码示例

本文整理汇总了C#中IScheduler.Post方法的典型用法代码示例。如果您正苦于以下问题:C# IScheduler.Post方法的具体用法?C# IScheduler.Post怎么用?C# IScheduler.Post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScheduler的用法示例。


在下文中一共展示了IScheduler.Post方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        public void Start()
        {
            m_Scheduler = KayakScheduler.Factory.Create(new SchedulerDelegate());
            m_Server = KayakServer.Factory.CreateHttp(new NancyRequestDelegate(m_Engine), m_Scheduler);

            IDisposable disposable = m_Server.Listen(m_EndPoint);
            Thread schedulerWorkerThread = new Thread(SchedulerWorker);
            schedulerWorkerThread.IsBackground = true;
            schedulerWorkerThread.Start(disposable);
            m_Scheduler.Post(GetLocalPort);
        }
开发者ID:rmc47,项目名称:CloudlogCAT,代码行数:11,代码来源:HttpHost.cs

示例2: RescheduleBody

        static BodyDelegate RescheduleBody(IScheduler theScheduler, BodyDelegate body)
        {
            // flush and end are tranported on theScheduler.
            // write is not, because you want the return value to be
            // false when the data is not buffering.

            return (write, flush, end, cancel) =>
                theScheduler.Post(() =>
                    body(
                        write,
                        drained =>
                        {
                            theScheduler.Post(() =>
                            {
                                if (!flush(() => if (drained != null) theScheduler.Post(drained)))
                                    if (drained != null) drained.Invoke();
                            });
开发者ID:kevinswiber,项目名称:gate,代码行数:17,代码来源:SchedulerMiddleware.cs

示例3: SetUp

        public void SetUp()
        {
            ep = new IPEndPoint(IPAddress.Loopback, Config.Port);

            wh = new ManualResetEventSlim();

            schedulerDelegate = new SchedulerDelegate();
            scheduler = new DefaultKayakScheduler(schedulerDelegate);

            schedulerDelegate.OnStoppedAction = () =>
            {
                stopListening.Dispose();
                stopListening = null;
                wh.Set();
            };
            schedulerDelegate.OnExceptionAction = e =>
            {
                schedulerError = e;
                Debug.WriteLine("Error on scheduler");
                e.DebugStackTrace();
                scheduler.Stop();
            };

            scheduler.Post(() =>
            {
                stopListening = server.Listen(ep);
                schedulerStartedAction();
            });

            serverDelegate = new ServerDelegate();
            server = new DefaultKayakServer(serverDelegate, scheduler);

            clientSocketDelegate = new SocketDelegate();
            client = new DefaultKayakSocket(clientSocketDelegate, scheduler);
        }
开发者ID:reider-roque,项目名称:Elpis,代码行数:35,代码来源:NetTests.cs

示例4: RescheduleBody

        static BodyDelegate RescheduleBody(IScheduler theScheduler, BodyDelegate body)
        {
            // flush and end are tranported on theScheduler.
            // write is not, because you want the return value to be
            // false when the data is not buffering.

            return (write, end, cancel) =>
                theScheduler.Post(() =>
                    body(
                        (data, callback) =>
                        {
                            if (callback == null)
                            {
                                return write(data, callback);
                            }

                            theScheduler.Post(() =>
                            {
                                if (!write(data, () => { theScheduler.Post(callback); }))
                                    callback.Invoke();
                            });
                            return true;
                        },
                        ex => theScheduler.Post(() => end(ex)),
                        cancel));
        }
开发者ID:anurse,项目名称:gate,代码行数:26,代码来源:SchedulerMiddleware.cs

示例5: RunApplication

        public void RunApplication(int port, Action<FubuRuntime> activation)
        {
            _port = port;

            _listeningEndpoint = new IPEndPoint(IPAddress.Any, _port);
            Console.WriteLine("Listening on " + _listeningEndpoint);

            _applicationDelegate = AppBuilder.BuildConfiguration(x => x.RescheduleCallbacks().Run(ExecuteRequest));

            _scheduler = KayakScheduler.Factory.Create(_schedulerDelegate);
            _server = KayakServer.Factory.CreateGate(_applicationDelegate, _scheduler, null);

            if (_listeningEndpoint == null)
            {
                throw new InvalidOperationException("Start() can only be called after RunApplication() and Stop()");
            }

            var runtime = rebuildFubuMVCApplication();

            _kayakListenerDisposer = _server.Listen(_listeningEndpoint);
                _scheduler.Post(() => ThreadPool.QueueUserWorkItem(o => activation(runtime)));
                _scheduler.Start();
        }
开发者ID:DRHouk,项目名称:fubumvc,代码行数:23,代码来源:FubuOwinHost.cs

示例6: SetUp

        public void SetUp()
        {
            ep = new IPEndPoint(IPAddress.Loopback, Config.Port);

            wh = new ManualResetEventSlim();

            IDisposable d = null;

            var schedulerDelegate = new SchedulerDelegate();
            schedulerDelegate.OnStoppedAction = () =>
            {
                d.Dispose();
                wh.Set();
            };

            scheduler = new KayakScheduler(schedulerDelegate);
            scheduler.Post(() =>
            {
                d = server.Listen(ep);
                schedulerStartedAction();
            });

            var serverDelegate = new ServerDelegate();
            server = new KayakServer(serverDelegate, scheduler);

            clientSocketDelegate = new SocketDelegate();
            client = new KayakSocket(clientSocketDelegate, scheduler);
        }
开发者ID:edazdarevic,项目名称:kayak,代码行数:28,代码来源:SocketTests.cs


注:本文中的IScheduler.Post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。