vpnengine/sit/src/sitdeathobserver.cpp
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2003 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: SIT thread death observer.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "sitdeathobserver.h"
       
    21 
       
    22 CSitDeathObserver::CSitDeathObserver(const TThreadId aThreadId, MSitDeathListener* aSitDeathListener)
       
    23     : CActive(EPriorityNormal), iThreadId(aThreadId), iSitDeathListener(aSitDeathListener)
       
    24     {
       
    25     CActiveScheduler::Add(this);
       
    26     }
       
    27 
       
    28 CSitDeathObserver::~CSitDeathObserver()
       
    29     {
       
    30     Cancel();
       
    31     }
       
    32     
       
    33 void CSitDeathObserver::StartObservingL()
       
    34     {
       
    35     User::LeaveIfError(iThreadToObserve.Open(iThreadId));
       
    36     iThreadToObserve.Logon(iStatus);
       
    37     SetActive();
       
    38     }
       
    39 
       
    40 void CSitDeathObserver::DoCancel()
       
    41     {
       
    42     iThreadToObserve.LogonCancel(iStatus);
       
    43     iThreadToObserve.Close();
       
    44     }
       
    45 
       
    46 void CSitDeathObserver::RunL()
       
    47     {
       
    48     iSitDeathListener->SitDied();
       
    49     iThreadToObserve.Close();
       
    50     }