Explorar el Código

修复ETTask对象池一个bug

tanghai hace 3 años
padre
commit
576500356c
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      Unity/Assets/Scripts/ThirdParty/ETTask/ETTask.cs

+ 3 - 3
Unity/Assets/Scripts/ThirdParty/ETTask/ETTask.cs

@@ -195,12 +195,12 @@ namespace ET
             this.callback = null;
             this.callback = null;
             this.value = default;
             this.value = default;
             this.state = AwaiterStatus.Pending;
             this.state = AwaiterStatus.Pending;
-            queue.Enqueue(this);
-            // 太多了,回收一下
+            // 太多了
             if (queue.Count > 1000)
             if (queue.Count > 1000)
             {
             {
-                queue.Clear();
+                return;
             }
             }
+            queue.Enqueue(this);
         }
         }
 
 
         private bool fromPool;
         private bool fromPool;