Beispiel #1
0
        public static ILooper AddLooper(LooperDelegate looper)
        {
            if (sInitilized && looper != null)
            {
                var loop = new Looper(looper);
                sInstance.mLoopers.AddLast(loop);
                return(loop);
            }
            else
            {
#if UNITY_EDITOR
                if (!sInitilized && Application.isPlaying)
                {
                    RTLog.LogError(LogCat.Game, "MainThread not initialized.");
                }
#endif
                return(null);
            }
        }
Beispiel #2
0
        double Loop7Test()
        {
            LooperDelegate looper = new LooperDelegate(Looper);

            IAsyncResult[] results = new IAsyncResult[N];

            double start = Hand.CurrentTime;

            long count = 0;

            for (int i = 0; i < N; i++)
            {
                results[i] = looper.BeginInvoke(7, null, null);
            }

            for (int i = 0; i < N; i++)
            {
                count += looper.EndInvoke(results[i]);
            }

            return(count / (Hand.CurrentTime - start));
        }
Beispiel #3
0
 public Looper(LooperDelegate dele)
 {
     mDelegate = dele;
     IsActive  = dele != null;
 }