Пример #1
0
 //---------------------------------------------------------------------
 public void addSaverRequest(EntitySaver saver)
 {
     lock (mLockQueEntitySaveRequest)
     {
         mQueEntitySaveRequest.Enqueue(saver);
     }
 }
Пример #2
0
        //---------------------------------------------------------------------
        void _threadSerializer()
        {
            while (true)
            {
                // 处理Entity Load
                if (!mSignDestroy)
                {
                    EntityLoader loader = null;
                    lock (mLockQueEntityLoadRequest)
                    {
                        if (mQueEntityLoadRequest.Count > 0)
                        {
                            loader = mQueEntityLoadRequest.Dequeue();
                        }
                    }

                    if (loader != null)
                    {
                        loader.handleLoad();

                        lock (mLockQueEntityLoadResponse)
                        {
                            mQueEntityLoadResponse.Enqueue(loader);
                        }
                    }
                }

                // 处理Entity Save
                {
                    EntitySaver saver = null;

                    lock (mLockQueEntitySaveRequest)
                    {
                        if (mQueEntitySaveRequest.Count > 0)
                        {
                            saver = mQueEntitySaveRequest.Dequeue();
                        }
                    }

                    if (saver != null)
                    {
                        saver.handleSave();
                    }

                    if (mSignDestroy)
                    {
                        lock (mLockQueEntitySaveRequest)
                        {
                            if (mQueEntitySaveRequest.Count == 0)
                            {
                                break;
                            }
                        }
                    }
                }

                Thread.Sleep(10);
            }
        }
Пример #3
0
 //---------------------------------------------------------------------
 public void asyncSaveEntity(EntitySaver saver)
 {
     mEntitySerializerMgr.addSaverRequest(saver);
 }