crashanalysercmd/PerfToolsSharedLibraries/Engine/SymBuildParsingLib/Parser/Framework/Parser/SymParserWaiter.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 using System;
       
    19 using SymbianTree;
       
    20 using SymBuildParsingLib.Utils;
       
    21 using SymBuildParsingLib.Tree;
       
    22 using SymBuildParsingLib.Common.Objects;
       
    23 using SymBuildParsingLib.Parser.Framework.Parser;
       
    24 
       
    25 namespace SymBuildParsingLib.Parser.Framework.Parser
       
    26 {
       
    27 	public class SymParserWaiter
       
    28 	{
       
    29 		#region Constructors & destructor
       
    30 		public SymParserWaiter( SymParserBase aParser )
       
    31 		{
       
    32 			iParser = aParser;
       
    33 			//
       
    34 			iParser.ParserObservers += new SymBuildParsingLib.Parser.Framework.Parser.SymParserBase.ParserObserver( HandleParserEvent );
       
    35 		}
       
    36 		#endregion
       
    37 
       
    38 		#region API
       
    39 		public void Wait()
       
    40 		{
       
    41 			iSemaphore.Wait();
       
    42 		}
       
    43 		#endregion
       
    44 
       
    45 		#region Parser event handler
       
    46 		private void HandleParserEvent(SymParserBase aParser, SymBuildParsingLib.Parser.Framework.Parser.SymParserBase.TEvent aEvent)
       
    47 		{
       
    48 			if	( aEvent == SymParserBase.TEvent.EEventParsingComplete )
       
    49 			{
       
    50 				iSemaphore.Signal();
       
    51 			}
       
    52 		}
       
    53 		#endregion
       
    54 
       
    55 		#region Data members
       
    56 		private readonly SymParserBase iParser;
       
    57 		private SymSemaphore iSemaphore = new SymSemaphore( 0, 1 );
       
    58 		#endregion
       
    59 	}
       
    60 }