示例#1
0
            internal CMtThread(int index, CMtCoder mtCoder) // CMtThread_Construct
            {
                Trace.MatchObjectCreate(this, "CMtThread_Construct");

                mIndex   = index;
                mMtCoder = mtCoder;
                mOutBuf  = null;
                mInBuf   = null;

                Event_Construct(out mCanRead);
                Event_Construct(out mCanWrite);

                mThread = new CLoopThread();
            }
示例#2
0
            public CLzma2Enc(ISzAlloc alloc, ISzAlloc allocBig) // Lzma2Enc_Create
            {
                Trace.AllocSmallObject("CLzma2Enc", alloc);

                mProps.Lzma2EncProps_Init();
                mProps.Lzma2EncProps_Normalize();
                mOutBuf   = null;
                mAlloc    = alloc;
                mAllocBig = allocBig;

                mCoders = new CLzma2EncInternal[NUM_MT_CODER_THREADS_MAX];
                for (int i = 0; i < mCoders.Length; i++)
                {
                    mCoders[i]      = new CLzma2EncInternal();
                    mCoders[i].mEnc = null;
                }

#if !_7ZIP_ST
                mMtCoder = new CMtCoder();
#endif
            }
示例#3
0
            // Lzma2Enc_Create
            public CLzma2Enc(ISzAlloc alloc, ISzAlloc allocBig)
            {
                Trace.AllocSmallObject("CLzma2Enc", alloc);

                mProps.Lzma2EncProps_Init();
                mProps.Lzma2EncProps_Normalize();
                mOutBuf = null;
                mAlloc = alloc;
                mAllocBig = allocBig;

                mCoders = new CLzma2EncInternal[NUM_MT_CODER_THREADS_MAX];
                for (int i = 0; i < mCoders.Length; i++)
                {
                    mCoders[i] = new CLzma2EncInternal();
                    mCoders[i].mEnc = null;
                }

                #if !_7ZIP_ST
                mMtCoder = new CMtCoder();
                #endif
            }
示例#4
0
            internal SRes MtThread_Process(out bool stop)
            {
                stop = true;
                if (Event_Wait(mCanRead) != 0)
                {
                    return(SZ_ERROR_THREAD);
                }

                CMtThread next = GET_NEXT_THREAD();

                Trace.MatchObjectWait(this, "MtThread_Process");
                if (mStopReading)
                {
                    next.mStopReading = true;
                    Trace.MatchObjectWait(this, "MtThread_Process");
                    return(Event_Set(next.mCanRead) == 0 ? SZ_OK : SZ_ERROR_THREAD);
                }
                Trace.MatchObjectWait(this, "MtThread_Process");

                {
                    long size     = mMtCoder.mBlockSize;
                    long destSize = mOutBufSize;

                    SRes res;
                    if ((res = CMtCoder.FullRead(mMtCoder.mInStream, mInBuf, ref size)) != SZ_OK)
                    {
                        return(res);
                    }

                    stop = (size != mMtCoder.mBlockSize);

                    Trace.MatchObjectWait(this, "MtThread_Process:2");
                    next.mStopReading = stop;
                    Trace.MatchObjectWait(this, "MtThread_Process:2");

                    if (Event_Set(next.mCanRead) != 0)
                    {
                        return(SZ_ERROR_THREAD);
                    }

                    if ((res = mMtCoder.mMtCallback.Code(mIndex, mOutBuf, ref destSize, mInBuf, size, stop)) != SZ_OK)
                    {
                        return(res);
                    }

                    mMtCoder.mMtProgress.MtProgress_Reinit(mIndex);

                    if (Event_Wait(mCanWrite) != 0)
                    {
                        return(SZ_ERROR_THREAD);
                    }

                    Trace.MatchObjectWait(this, "MtThread_Process:3");
                    if (mStopWriting)
                    {
                        Trace.MatchObjectWait(this, "MtThread_Process:3");
                        return(SZ_ERROR_FAIL);
                    }
                    Trace.MatchObjectWait(this, "MtThread_Process:3");

                    if (mMtCoder.mOutStream.Write(mOutBuf, destSize) != destSize)
                    {
                        return(SZ_ERROR_WRITE);
                    }

                    return(Event_Set(next.mCanWrite) == 0 ? SZ_OK : SZ_ERROR_THREAD);
                }
            }
示例#5
0
            // CMtThread_Construct
            internal CMtThread(int index, CMtCoder mtCoder)
            {
                Trace.MatchObjectCreate(this, "CMtThread_Construct");

                mIndex = index;
                mMtCoder = mtCoder;
                mOutBuf = null;
                mInBuf = null;

                Event_Construct(out mCanRead);
                Event_Construct(out mCanWrite);

                mThread = new CLoopThread();
            }