core/builtins/undertaker.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // undertaker.h
       
     2 // 
       
     3 // Copyright (c) 2005 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #ifndef UNDERTAKER_H
       
    14 #define UNDERTAKER_H
       
    15 
       
    16 #include <fshell/ioutils.h>
       
    17 #include <fshell/memoryaccesscmd.h>
       
    18 
       
    19 using namespace IoUtils;
       
    20 
       
    21 class CCmdUndertaker : public CMemoryAccessCommandBase
       
    22 	{
       
    23 public:
       
    24 	static CCommandBase* NewLC();
       
    25 	~CCmdUndertaker();
       
    26 private:
       
    27 	CCmdUndertaker();
       
    28 	void ConstructL();
       
    29 	TInt Queue();
       
    30 	void ProcessHandle(TInt aDeadThreadHandle);
       
    31 	static TInt WorkerThreadFn(TAny* aSelf);
       
    32 	TInt DoWork();
       
    33 	void CloseProcessOwnedHandles();
       
    34 private: // From CCommandBase.
       
    35 	virtual const TDesC& Name() const;
       
    36 	virtual void DoRunL();
       
    37 	virtual void OptionsL(RCommandOptionList& aOptions);
       
    38 private: // From CActive
       
    39 	void RunL();
       
    40 	void DoCancel();
       
    41 
       
    42 private:
       
    43 	TInt iDeadThreadHandle;
       
    44 	RUndertaker iUndertaker;
       
    45 	TBool iAll;
       
    46 	TBool iLeakThreads;
       
    47 	TBool iParanoid;
       
    48 	// The following are only used if in paranoid mode
       
    49 	RFastLock iLock;
       
    50 	RArray<TInt> iHandles;
       
    51 	RThread iWorkerThread;
       
    52 	RThread iMainThread;
       
    53 	TRequestStatus iMainThreadStat;
       
    54 	};
       
    55 
       
    56 #endif