public ApplicationContext(IServiceContainer container, IMainLoopExecutor mainLoopExecutor) : base(container, null) { this.mainLoopExecutor = mainLoopExecutor; if (this.mainLoopExecutor == null) { this.mainLoopExecutor = new MainLoopExecutor(); } }
void Start() { this.executor = new MainLoopExecutor(); Debug.LogFormat("ThreadID:{0}", Thread.CurrentThread.ManagedThreadId); ThreadPool.QueueUserWorkItem((state) => { this.executor.RunOnMainThread(Task1, true); string name = this.executor.RunOnMainThread <string> (Task2); Debug.LogFormat("run on the backgound thread. ThreadID:{0}", Thread.CurrentThread.ManagedThreadId); }); }
void Start() { this.executor = new MainLoopExecutor(); Debug.LogFormat("ThreadID:{0}", Thread.CurrentThread.ManagedThreadId); Executors.RunAsync(() => { this.executor.RunOnMainThread(Task1, true); this.executor.RunOnMainThread <string> (Task2); Debug.LogFormat("run on the backgound thread. ThreadID:{0}", Thread.CurrentThread.ManagedThreadId); }); }