Esempio n. 1
0
 void Tick()
 {
     if (mLoginQueue.Count > 0)
     {
         AsyncExecuter atom = null;
         lock (this)
         {
             atom = mLoginQueue[0];
             if (atom.Exec != null)
             {
                 mLoginQueue.RemoveAt(0);
             }
             else
             {
                 return;
             }
         }
         try
         {
             atom.Exec();
         }
         catch (System.Exception ex)
         {
             Log.Log.Common.Print(ex.ToString());
             Log.Log.Common.Print(ex.StackTrace.ToString());
         }
     }
 }
Esempio n. 2
0
        public void PushExecuter(CSCommon.Data.PlayerDataEx roleId, ServerFrame.DB.AsyncExecuter exec)
        {
            PlayerSaver       saver    = null;
            PlayerSaverThread thread   = null;
            Int32             mincount = Int32.MaxValue;

            foreach (var i in mSaveThreads)
            {
                int count = i.GetPlayerCount();
                if (count < mincount)
                {
                    mincount = count;
                    thread   = i;
                }
                saver = i.FindPlayerSaver(roleId);
                if (saver != null)
                {
                    break;
                }
            }
            if (saver == null)
            {
                saver = thread.AddPlayer(roleId);
            }
            ServerFrame.DB.DBOperator sqlAtom = new ServerFrame.DB.DBOperator();
            sqlAtom.Executer = exec;
            saver.Push(sqlAtom);
            saver.mWaitRemove = false;//只要有数据重新要存储,说明他又登陆进来了,不需要remove了
        }
Esempio n. 3
0
        public AsyncExecuter AsyncExe(bool pushQueue)
        {
            AsyncExecuter holder = new AsyncExecuter();

            if (pushQueue)
            {
                lock (this)
                {
                    mLoginQueue.Add(holder);
                }
            }
            return(holder);
        }