コード例 #1
0
        public void QueueAction <T1, T2, T3, T4, T5, T6, T7, R>(MyFunc <T1, T2, T3, T4, T5, T6, T7, R> action, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
        {
            bool needUseLambda = true;
            ClientConcurrentObjectPool <ClientConcurrentPoolAllocatedFunc <T1, T2, T3, T4, T5, T6, T7, R> > pool;

            m_ActionPools.GetOrNewData(out pool);
            if (null != pool)
            {
                ClientConcurrentPoolAllocatedFunc <T1, T2, T3, T4, T5, T6, T7, R> helper = pool.Alloc();
                if (null != helper)
                {
                    helper.Init(action, t1, t2, t3, t4, t5, t6, t7);
                    m_Actions.Enqueue(helper.Run);
                    needUseLambda = false;
                }
            }
            if (needUseLambda)
            {
                m_Actions.Enqueue(() => { action(t1, t2, t3, t4, t5, t6, t7); });
                LogSystem.Warn("QueueAction {0}({1},{2},{3},{4},{5},{6},{7}) use lambda expression, maybe out of memory.", action.Method.ToString(), t1, t2, t3, t4, t5, t6, t7);
            }
        }
コード例 #2
0
        public void QueueAction <T1, R>(MyFunc <T1, R> action, T1 t1)
        {
            bool needUseLambda = true;
            ClientConcurrentObjectPool <ClientConcurrentPoolAllocatedFunc <T1, R> > pool;

            m_ActionPools.GetOrNewData(out pool);
            if (null != pool)
            {
                ClientConcurrentPoolAllocatedFunc <T1, R> helper = pool.Alloc();
                if (null != helper)
                {
                    helper.Init(action, t1);
                    m_Actions.Enqueue(helper.Run);
                    needUseLambda = false;
                }
            }
            if (needUseLambda)
            {
                m_Actions.Enqueue(() => { action(t1); });
                LogSystem.Warn("QueueAction {0}({1}) use lambda expression, maybe out of memory.", action.Method.ToString(), t1);
            }
        }