memspy/Engine/Source/Helpers/MemSpyEngineHelperCondVar.cpp
changeset 0 a03f92240627
equal deleted inserted replaced
-1:000000000000 0:a03f92240627
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <memspy/engine/memspyenginehelpercondvar.h>
       
    19 
       
    20 // Driver includes
       
    21 #include <memspy/driver/memspydriverclient.h>
       
    22 
       
    23 // User includes
       
    24 #include <memspy/engine/memspyengine.h>
       
    25 
       
    26 
       
    27 
       
    28 CMemSpyEngineHelperCondVar::CMemSpyEngineHelperCondVar( CMemSpyEngine& aEngine )
       
    29 :   iEngine( aEngine )
       
    30     {
       
    31     }
       
    32 
       
    33     
       
    34 CMemSpyEngineHelperCondVar::~CMemSpyEngineHelperCondVar()
       
    35     {
       
    36     }
       
    37 
       
    38 
       
    39 void CMemSpyEngineHelperCondVar::ConstructL()
       
    40     {
       
    41     }
       
    42 
       
    43 
       
    44 CMemSpyEngineHelperCondVar* CMemSpyEngineHelperCondVar::NewL( CMemSpyEngine& aEngine )
       
    45     {
       
    46     CMemSpyEngineHelperCondVar* self = new(ELeave) CMemSpyEngineHelperCondVar( aEngine );
       
    47     CleanupStack::PushL( self );
       
    48     self->ConstructL();
       
    49     CleanupStack::Pop( self );
       
    50     return self;
       
    51     }
       
    52 
       
    53 EXPORT_C void CMemSpyEngineHelperCondVar::GetCondVarSuspendedThreadsL( const TMemSpyDriverHandleInfoGeneric& aCondVarDetails, RArray<TMemSpyDriverCondVarSuspendedThreadInfo>& aThreads )
       
    54     {   
       
    55     const TInt KMaxCount = 256;
       
    56     TAny* handles[KMaxCount];
       
    57     TInt c = KMaxCount;
       
    58 
       
    59     TInt r = iEngine.Driver().GetCondVarSuspendedThreads( aCondVarDetails.iHandle, handles, c );
       
    60     if  ( r == KErrNone )
       
    61         {
       
    62         if  ( c > 0 )
       
    63             {
       
    64             if (c > KMaxCount)
       
    65                 {
       
    66                 c = KMaxCount;
       
    67                 }
       
    68 
       
    69             TMemSpyDriverCondVarSuspendedThreadInfo info;
       
    70             for (TInt i=0; i<c; i++)
       
    71                 {
       
    72                 r = iEngine.Driver().GetCondVarSuspendedThreadInfo( handles[i], info );
       
    73                 if (r == KErrNone)
       
    74                     {
       
    75                     aThreads.AppendL( info );
       
    76                     }
       
    77                 }
       
    78             }
       
    79         }
       
    80     }