Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions unity_rtm_sdk/Projects/Rtm-Scripts/tools/AgoraCallbackQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ public void EnQueue(Action action)
{
lock (queue)
{
if (queue.Count >= 250)
{
queue.Dequeue();
}
queue.Enqueue(action);
}
}
Expand All @@ -47,13 +43,16 @@ void Awake()
// Update is called once per frame
void Update()
{
var action = DeQueue();

if (action != null)
lock (queue)
{
action();
while (queue.Count > 0)
{
Action action = queue.Dequeue();
if (action != null) {
action.Invoke();
}
}
}
action = null;
}

void OnDestroy()
Expand Down