public override bool AddReqs(RGChunk chunk)
    {
        if (mActive)
        {
            Debug.LogError("The data IO is already acitve");
            return(false);
        }

        lock (mReqs)
        {
            mReqs.Enqueue(chunk);
        }

        return(true);
    }
    void Run()
    {
        try
        {
            while (mRunning)
            {
                if (!mActive)
                {
                    Thread.Sleep(10);
                    continue;
                }

                Monitor.TryEnter(VFDataRTGen.s_dicGrassInstList);

                try
                {
                    while (true)
                    {
                        RGChunk chunk = null;

                        lock (mReqs)
                        {
                            if (mReqs.Count == 0)
                            {
                                break;
                            }
                            chunk = mReqs.Dequeue();
                        }


                        INTVECTOR3 chunk32Pos = ChunkPosToPos32(chunk.xIndex, chunk.zIndex);

                        int expands = mEvni.CHUNKSIZE / mEvni.Tile;

                        lock (chunk)
                        {
                            for (int x = chunk32Pos.x; x < chunk32Pos.x + expands; ++x)
                            {
                                for (int z = chunk32Pos.z; z < chunk32Pos.z + expands; ++z)
                                {
                                    IntVector2 key = new IntVector2(x, z);
                                    if (VFDataRTGen.s_dicGrassInstList.ContainsKey(key))
                                    {
                                        foreach (VoxelGrassInstance vgi in VFDataRTGen.s_dicGrassInstList[key])
                                        {
                                            RedGrassInstance rgi = new RedGrassInstance();
                                            rgi.CopyTo(vgi);

                                            Vector3 pos = rgi.Position;
                                            if (!GrassDataSL.m_mapDelPos.ContainsKey(new INTVECTOR3((int)pos.x, (int)pos.y, (int)pos.z)))
                                            {
                                                chunk.Write(rgi);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                finally
                {
                    Monitor.Exit(VFDataRTGen.s_dicGrassInstList);
                }

                mStart = false;
                Thread.Sleep(10);
            }
        }
        catch (System.Exception ex)
        {
            Debug.LogError(ex.ToString());
        }
    }
    void Run()
    {
        try
        {
            while (mRunning)
            {
                if (!mActive)
                {
                    Thread.Sleep(10);
                    continue;
                }

                while (true)
                {
                    RGChunk chunk = null;

                    lock (mReqs)
                    {
                        if (mReqs.Count == 0)
                        {
                            break;
                        }
                        chunk = mReqs.Dequeue();
                    }

                    lock (mDestoryLockObj)
                    {
                        INTVECTOR3 chunk32Pos = ChunkPosToPos32(chunk.xIndex, chunk.zIndex);

                        // Find the file index
                        int file_index = FindOrginFileIndex(chunk32Pos);

                        if (file_index != -1 && mOrgnGrassFile[file_index] != null)
                        {
                            BinaryReader _in = new BinaryReader(mOrgnGrassFile[file_index]);

                            int expands = mEvni.CHUNKSIZE / mEvni.Tile;

                            lock (chunk)
                            {
                                for (int x = chunk32Pos.x; x < chunk32Pos.x + expands; ++x)
                                {
                                    for (int z = chunk32Pos.z; z < chunk32Pos.z + expands; ++z)
                                    {
                                        int _x = x % mEvni.XTileCount;
                                        int _z = z % mEvni.ZTileCount;

                                        int index32 = Pos32ToIndex32(_x, _z);

                                        if (mOrgnOfsData[file_index, index32] > 0)
                                        {
                                            _in.BaseStream.Seek(mOrgnOfsData[file_index, index32], SeekOrigin.Begin);
                                            int count = _in.ReadInt32();

                                            for (int i = 0; i < count; ++i)
                                            {
                                                RedGrassInstance rgi = new RedGrassInstance();
                                                rgi.ReadFromStream(_in);

                                                Vector3 pos = rgi.Position;
                                                if (!GrassDataSL.m_mapDelPos.ContainsKey(new INTVECTOR3((int)pos.x, (int)pos.y, (int)pos.z)))
                                                {
                                                    chunk.Write(rgi);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                mStart = false;

                Thread.Sleep(10);
            }
        }
        catch (System.Exception ex)
        {
            Debug.LogWarning("<<<< Data IO Thread error >>>> \r\n" + ex);
        }
    }