コード例 #1
0
        protected WaitForMultipleEvents(Coroutine coroutine, Event[] requests,
            double seconds, params Event[] e)
        {
            this.coroutine = coroutine;

            if (!Object.ReferenceEquals(requests, null))
            {
                waitHandle = WaitHandlePool.Acquire();
                for (int i = 0, count = requests.Length; i < count; ++i)
                {
                    requests[i]._WaitHandle = waitHandle;
                }
                for (int i = 0, count = e.Length; i < count; ++i)
                {
                    e[i]._WaitHandle = waitHandle;
                }
            }

            expected = e;
            actual = new Event[expected.Length];

            handlerTokens = new Binder.Token[expected.Length];
            for (int i = 0; i < expected.Length; ++i)
            {
                handlerTokens[i] = Flow.Bind(expected[i], OnEvent);
            }

            if (seconds > 0)
            {
                TimeoutEvent timeoutEvent = new TimeoutEvent { Key = this };
                timeoutToken = Flow.Bind(timeoutEvent, OnTimeout);
                timerToken = TimeFlow.Default.Reserve(timeoutEvent, seconds);
            }
        }
コード例 #2
0
ファイル: WaitForSeconds.cs プロジェクト: gitter-badger/x2clr
 public WaitForSeconds(Coroutine coroutine, double seconds)
 {
     this.coroutine = coroutine;
     TimeoutEvent e = new TimeoutEvent { Key = this };
     token = Flow.Bind(e, OnTimeout);
     TimeFlow.Default.Reserve(e, seconds);
 }
コード例 #3
0
ファイル: WaitForSeconds.cs プロジェクト: jaykang920/x2clr
 public WaitForNothing(Coroutine coroutine, object result)
 {
     this.coroutine = coroutine;
     this.result = result;
     TimeoutEvent e = new TimeoutEvent { Key = this };
     token = Flow.Bind(e, OnTimeout);
     Hub.Post(e);
 }
コード例 #4
0
        public WaitForMultipleEvents(Coroutine coroutine, params Event[] e)
        {
            this.coroutine = coroutine;
            expected = e;
            actual = new Event[expected.Length];

            for (int i = 0; i < expected.Length; ++i)
            {
                Flow.Bind(expected[i], OnEvent);
            }
        }
コード例 #5
0
 public WaitForSingleEvent(Coroutine coroutine, Event e, double seconds)
 {
     this.coroutine = coroutine;
     handlerToken = Flow.Bind(e, OnEvent);
     if (seconds >= 0)
     {
         TimeoutEvent timeoutEvent = new TimeoutEvent { Key = this };
         timeoutToken = Flow.Bind(timeoutEvent, OnTimeout);
         timerToken = TimeFlow.Default.Reserve(timeoutEvent, seconds);
     }
 }
コード例 #6
0
        protected WaitForSingleEvent(Coroutine coroutine, Event request, Event e, double seconds)
        {
            this.coroutine = coroutine;

            if (!Object.ReferenceEquals(request, null))
            {
                int waitHandle = WaitHandlePool.Acquire();
                request._WaitHandle = waitHandle;
                e._WaitHandle = waitHandle;
            }

            handlerToken = Flow.Bind(e, OnEvent);
            if (seconds > 0)
            {
                TimeoutEvent timeoutEvent = new TimeoutEvent { Key = this };
                timeoutToken = Flow.Bind(timeoutEvent, OnTimeout);
                timerToken = TimeFlow.Default.Reserve(timeoutEvent, seconds);
            }
        }
コード例 #7
0
 public WaitForSingleEvent(Coroutine coroutine, Event e)
     : this(coroutine, null, e, Config.Coroutine.DefaultTimeout)
 {
 }
コード例 #8
0
 public WaitForSingleResponse(Coroutine coroutine, Event request,
         Event response)
     : this(coroutine, request, response, Config.Coroutine.DefaultTimeout)
 {
 }
コード例 #9
0
 public WaitForSingleResponse(Coroutine coroutine, Event request,
         Event response, double seconds)
     : base(coroutine, request, response, seconds)
 {
     if (Object.ReferenceEquals(request, null))
     {
         throw new ArgumentNullException();
     }
     request.Post();
 }
コード例 #10
0
 public WaitForSingleResponse(Coroutine coroutine, Event request, Event response)
     : base(coroutine, response)
 {
     request.Post();
 }
コード例 #11
0
ファイル: WaitForCompletion.cs プロジェクト: jaykang920/x2clr
 public WaitForCompletion(Coroutine coroutine,
     Func<Coroutine, IEnumerator> func)
 {
     Coroutine c = new Coroutine(coroutine);
     c.Start(func(c));
 }
コード例 #12
0
 public WaitForSingleEvent(Coroutine coroutine, Event e)
     : this(coroutine, e, 30.0)
 {
 }
コード例 #13
0
 public WaitForMultipleEvents(Coroutine coroutine, params Event[] e)
     : this(coroutine, null, Config.Coroutine.DefaultTimeout, e)
 {
 }
コード例 #14
0
 public WaitForMultipleResponses(Coroutine coroutine, Event[] requests,
         double seconds, params Event[] responses)
     : base(coroutine, requests, seconds, responses)
 {
     if (Object.ReferenceEquals(requests, null))
     {
         throw new ArgumentNullException();
     }
     for (int i = 0; i < requests.Length; ++i)
     {
         requests[i].Post();
     }
 }
コード例 #15
0
 public WaitForSingleEvent(Coroutine coroutine, Event e, double seconds)
     : this(coroutine, null, e, seconds)
 {
 }
コード例 #16
0
 public WaitForMultipleResponses(Coroutine coroutine, Event[] requests, params Event[] responses)
     : base(coroutine, responses)
 {
     for (int i = 0; i < requests.Length; ++i)
     {
         requests[i].Post();
     }
 }
コード例 #17
0
 public WaitForMultipleEvents(Coroutine coroutine, double seconds,
         params Event[] e)
     : this(coroutine, null, seconds, e)
 {
 }
コード例 #18
0
ファイル: WaitForSeconds.cs プロジェクト: jaykang920/x2clr
 public WaitForNothing(Coroutine coroutine)
     : this(coroutine, null)
 {
 }
コード例 #19
0
 public WaitForSingleResponse(Coroutine coroutine, Event request, Event response, double seconds)
     : base(coroutine, response, seconds)
 {
     request.Post();
 }
コード例 #20
0
 public WaitForMultipleResponses(Coroutine coroutine, Event[] requests,
         params Event[] responses)
     : this(coroutine, requests, Config.Coroutine.DefaultTimeout, responses)
 {
 }