memana/analyzetoolclient/dynamicmemoryhook/src/threadstack.cpp
changeset 2 6a82cd05fb1e
parent 1 3ff3fecb12fe
equal deleted inserted replaced
1:3ff3fecb12fe 2:6a82cd05fb1e
     1 /*
       
     2 * Copyright (c) 2009 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:  Definitions for the class TThreadStack.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "threadstack.h"
       
    20 #include "atlog.h"
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // TThreadStack::TThreadStack()
       
    24 // C++ default constructor.
       
    25 // -----------------------------------------------------------------------------
       
    26 //
       
    27 TThreadStack::TThreadStack( TThreadId aId, TUint32 aStackStart ) :
       
    28     iId( aId ),
       
    29     iStackStart( aStackStart )
       
    30     {
       
    31     LOGSTR2( "ATMH TThreadStack::TThreadStack() aStackStart: %i", aStackStart );
       
    32     }
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // TThreadStack::ThreadStackStart()
       
    36 // Checks if this is the current thread and if this is the current
       
    37 // thread assings value to the given parameter
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 TBool TThreadStack::ThreadStackStart( TUint32& aStackStart )
       
    41     {
       
    42     LOGSTR1( "ATMH TThreadStack::ThreadStackStart");
       
    43     
       
    44     if ( RThread().Id() == iId )
       
    45         {
       
    46         aStackStart = iStackStart;
       
    47         return ETrue;
       
    48         }
       
    49     else
       
    50         {
       
    51         aStackStart = 0;
       
    52         return EFalse;
       
    53         }
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // TThreadStack::Match()
       
    58 // Checks if this is the the current thread.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 TBool TThreadStack::Match( const TUint aThreadId )
       
    62     {
       
    63     LOGSTR2( "ATMH TThreadStack::Match( %d )", aThreadId );
       
    64     
       
    65     if ( aThreadId != 0 )
       
    66     	{
       
    67     	LOGSTR2( "ATMH > iId.operator TUint() = %d", iId.operator TUint() );
       
    68     	return ( aThreadId == iId.operator TUint() ) ? ETrue : EFalse;
       
    69     	}
       
    70     else
       
    71     	{
       
    72     	return ( RThread().Id() == iId ) ? ETrue : EFalse;
       
    73     	}
       
    74     }
       
    75     
       
    76 // End of File