public void QueueAction <T1, T2, T3>(MyAction <T1, T2, T3> action, T1 t1, T2 t2, T3 t3) { bool needUseLambda = true; ServerConcurrentObjectPool <ServerConcurrentPoolAllocatedAction <T1, T2, T3> > pool; m_ActionPools.GetOrNewData(out pool); if (null != pool) { ServerConcurrentPoolAllocatedAction <T1, T2, T3> helper = pool.Alloc(); if (null != helper) { helper.Init(action, t1, t2, t3); m_Actions.Enqueue(helper.Run); needUseLambda = false; } } if (needUseLambda) { m_Actions.Enqueue(() => { action(t1, t2, t3); }); LogSystem.Warn("QueueAction {0}({1},{2},{3}) use lambda expression, maybe out of memory.", action.Method.ToString(), t1, t2, t3); } }
public void QueueActionWithDelegation(Delegate action, params object[] args) { bool needUseLambda = true; ServerConcurrentObjectPool <ServerConcurrentPoolAllocatedAction> pool; m_ActionPools.GetOrNewData(out pool); if (null != pool) { ServerConcurrentPoolAllocatedAction helper = pool.Alloc(); if (null != helper) { helper.Init(action, args); m_Actions.Enqueue(helper.Run); needUseLambda = false; } } if (needUseLambda) { m_Actions.Enqueue(() => { action.DynamicInvoke(args); }); LogSystem.Warn("QueueActionWithDelegation {0} use lambda expression, maybe out of memory.", action.Method.ToString()); } }
public void QueueAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(MyAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> action, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16) { bool needUseLambda = true; ServerConcurrentObjectPool <ServerConcurrentPoolAllocatedAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> > pool; m_ActionPools.GetOrNewData(out pool); if (null != pool) { ServerConcurrentPoolAllocatedAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> helper = pool.Alloc(); if (null != helper) { helper.Init(action, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16); m_Actions.Enqueue(helper.Run); needUseLambda = false; } } if (needUseLambda) { m_Actions.Enqueue(() => { action(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16); }); LogSystem.Warn("QueueAction {0}({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16}) use lambda expression, maybe out of memory.", action.Method.ToString(), t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16); } }