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); } }
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)); }
public Looper(LooperDelegate dele) { mDelegate = dele; IsActive = dele != null; }