Пример #1
0
        private void CreateThreadMState(ParserParagraph aParagraph, DThread.TThreadState aState, string aMStateName, bool aCapturesWaitObject)
        {
            StringBuilder format = new StringBuilder("Thread MState");

            format.Append(" " + aMStateName);
            //
            if (aCapturesWaitObject)
            {
                format.Append(" %8x");
            }
            //
            string     finalFormat = format.ToString();
            ParserLine l1          = null;

            //
            if (aCapturesWaitObject)
            {
                l1 = ParserLine.NewSymFormat(finalFormat);
            }
            else
            {
                l1 = ParserLine.New(finalFormat);
            }

            l1.Tag              = aState;
            l1.ElementComplete += new ParserElementBase.ElementCompleteHandler(ThreadMState_ElementComplete);
            //
            if (aCapturesWaitObject)
            {
                l1[0].SetTargetMethod(this, "SetThreadMStateWaitObject");
            }
            //
            aParagraph.Add(l1);
        }
Пример #2
0
        void ThreadMState_ElementComplete(ParserElementBase aElement)
        {
            ParserLine      line      = (ParserLine)aElement;
            ParserParagraph paragraph = line.Paragraph;

            System.Diagnostics.Debug.Assert(paragraph.Tag is DThread);
            DThread thread = (DThread)paragraph.Tag;

            DThread.TThreadState state = (DThread.TThreadState)line.Tag;
            thread.MState = state;
        }