UnityMainThreadDispatcher icon indicating copy to clipboard operation
UnityMainThreadDispatcher copied to clipboard

Long waiting time for other async thread?

Open wangzhijiang-nreal opened this issue 4 years ago • 0 comments

Just be curious, what if an action is (computationally) heavy, does other thread wait for a long time for the lock to be released?

// UnityMainThreadDispatcher.cs

public void Update() {
    lock(_executionQueue) {
        while (_executionQueue.Count > 0) {
            _executionQueue.Dequeue().Invoke();
        }
    }
}

wangzhijiang-nreal avatar Sep 01 '21 05:09 wangzhijiang-nreal