RThread Class Reference

class RThread : public RHandleBase

A handle to a thread.

The thread itself is a kernel object.

Inherits from

Public Member Functions
RThread()
IMPORT_C voidContext(TDes8 &)
IMPORT_C TIntCreate(const TDesC &, TThreadFunction, TInt, TInt, TInt, TAny *, TOwnerType)
IMPORT_C TIntCreate(const TDesC &, TThreadFunction, TInt, RAllocator *, TAny *, TOwnerType)
IMPORT_C TIntCreate(const TThreadCreateInfo &)
TInt Create(const TDesC &, TThreadFunction, TInt, TAny *, RLibrary *, RHeap *, TInt, TInt, TOwnerType)
IMPORT_C TExitCategoryNameExitCategory()
IMPORT_C TIntExitReason()
IMPORT_C TExitTypeExitType()
IMPORT_C TIntGetCpuTime(TTimeIntervalMicroSeconds &)
IMPORT_C voidHandleCount(TInt &, TInt &)
TBool HasCapability(TCapability, const char *)
TBool HasCapability(TCapability, TCapability, const char *)
IMPORT_C TThreadIdId()
IMPORT_C voidKill(TInt)
IMPORT_C voidLogon(TRequestStatus &)
IMPORT_C TIntLogonCancel(TRequestStatus &)
IMPORT_C TIntOpen(const TDesC &, TOwnerType)
IMPORT_C TIntOpen(TThreadId, TOwnerType)
TInt Open(const TFindThread &, TOwnerType)
IMPORT_C voidPanic(const TDesC &, TInt)
IMPORT_C TThreadPriorityPriority()
IMPORT_C TIntProcess(RProcess &)
IMPORT_C TProcessPriorityProcessPriority()
TInt RenameMe(const TDesC &)
IMPORT_C voidRendezvous(TRequestStatus &)
IMPORT_C voidRendezvous(TInt)
IMPORT_C TIntRendezvousCancel(TRequestStatus &)
IMPORT_C voidRequestComplete(TRequestStatus *&, TInt)
IMPORT_C TIntRequestCount()
IMPORT_C voidRequestSignal()
IMPORT_C voidResume()
IMPORT_C TSecureIdSecureId()
IMPORT_C voidSetPriority(TThreadPriority)
IMPORT_C voidSetProcessPriority(TProcessPriority)
IMPORT_C TIntStackInfo(TThreadStackInfo &)
IMPORT_C voidSuspend()
IMPORT_C voidTerminate(TInt)
IMPORT_C TVendorIdVendorId()
Private Member Functions
IMPORT_C TBoolDoHasCapability(TCapability, const char *)
IMPORT_C TBoolDoHasCapability(TCapability)
IMPORT_C TBoolDoHasCapability(TCapability, TCapability, const char *)
IMPORT_C TBoolDoHasCapability(TCapability, TCapability)
Inherited Functions
RHandleBase::Attributes()const
RHandleBase::BTraceId()const
RHandleBase::Close()
RHandleBase::DoExtendedClose()
RHandleBase::Duplicate(const RThread &,TOwnerType)
RHandleBase::FullName()const
RHandleBase::FullName(TDes &)const
RHandleBase::Handle()const
RHandleBase::HandleInfo(THandleInfo *)
RHandleBase::Name()const
RHandleBase::NotifyDestruction(TRequestStatus &)
RHandleBase::Open(const TFindHandleBase &,TOwnerType)
RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
RHandleBase::RHandleBase()
RHandleBase::RHandleBase(TInt)
RHandleBase::SetHandle(TInt)
RHandleBase::SetHandleNC(TInt)
RHandleBase::SetReturnedHandle(TInt)
RHandleBase::SetReturnedHandle(TInt,RHandleBase &)
Inherited Enumerations
RHandleBase:TAttributes
Inherited Attributes
RHandleBase::iHandle

Constructor & Destructor Documentation

RThread()

RThread()[inline]

Default constructor.

The constructor exists to initialise private data within this handle; it does not create the thread object.

Specifically, it sets the handle-number to the value KCurrentThreadHandle. In effect, the constructor creates a default thread handle.

Member Functions Documentation

Context(TDes8 &)

IMPORT_C voidContext(TDes8 &aDes)const

Parameters

TDes8 & aDes

Create(const TDesC &, TThreadFunction, TInt, TInt, TInt, TAny *, TOwnerType)

IMPORT_C TIntCreate(const TDesC &aName,
TThreadFunctionaFunction,
TIntaStackSize,
TIntaHeapMinSize,
TIntaHeapMaxSize,
TAny *aPtr,
TOwnerTypeaType = EOwnerProcess
)

Parameters

const TDesC & aName
TThreadFunction aFunction
TInt aStackSize
TInt aHeapMinSize
TInt aHeapMaxSize
TAny * aPtr
TOwnerType aType = EOwnerProcess

Create(const TDesC &, TThreadFunction, TInt, RAllocator *, TAny *, TOwnerType)

IMPORT_C TIntCreate(const TDesC &aName,
TThreadFunctionaFunction,
TIntaStackSize,
RAllocator *aHeap,
TAny *aPtr,
TOwnerTypeaType = EOwnerProcess
)

Parameters

const TDesC & aName
TThreadFunction aFunction
TInt aStackSize
RAllocator * aHeap
TAny * aPtr
TOwnerType aType = EOwnerProcess

Create(const TThreadCreateInfo &)

IMPORT_C TIntCreate(const TThreadCreateInfo &aCreateInfo)

Parameters

const TThreadCreateInfo & aCreateInfo

Create(const TDesC &, TThreadFunction, TInt, TAny *, RLibrary *, RHeap *, TInt, TInt, TOwnerType)

TInt Create(const TDesC &aName,
TThreadFunctionaFunction,
TIntaStackSize,
TAny *aPtr,
RLibrary *aLibrary,
RHeap *aHeap,
TIntaHeapMinSize,
TIntaHeapMaxSize,
TOwnerTypeaType
)[inline]

Function only temporarily supported to aid migration to process emulation...

Use process emulation instead

Parameters

const TDesC & aName
TThreadFunction aFunction
TInt aStackSize
TAny * aPtr
RLibrary * aLibrary
RHeap * aHeap
TInt aHeapMinSize
TInt aHeapMaxSize
TOwnerType aType

DoHasCapability(TCapability, const char *)

IMPORT_C TBoolDoHasCapability(TCapabilityaCapability,
const char *aDiagnostic
)const [private]

Parameters

TCapability aCapability
const char * aDiagnostic

DoHasCapability(TCapability)

IMPORT_C TBoolDoHasCapability(TCapabilityaCapability)const [private]

Parameters

TCapability aCapability

DoHasCapability(TCapability, TCapability, const char *)

IMPORT_C TBoolDoHasCapability(TCapabilityaCapability1,
TCapabilityaCapability2,
const char *aDiagnostic
)const [private]

Parameters

TCapability aCapability1
TCapability aCapability2
const char * aDiagnostic

DoHasCapability(TCapability, TCapability)

IMPORT_C TBoolDoHasCapability(TCapabilityaCapability1,
TCapabilityaCapability2
)const [private]

Parameters

TCapability aCapability1
TCapability aCapability2

ExitCategory()

IMPORT_C TExitCategoryNameExitCategory()const

ExitReason()

IMPORT_C TIntExitReason()const

ExitType()

IMPORT_C TExitTypeExitType()const

GetCpuTime(TTimeIntervalMicroSeconds &)

IMPORT_C TIntGetCpuTime(TTimeIntervalMicroSeconds &aCpuTime)const

Parameters

TTimeIntervalMicroSeconds & aCpuTime

HandleCount(TInt &, TInt &)

IMPORT_C voidHandleCount(TInt &aProcessHandleCount,
TInt &aThreadHandleCount
)const

Parameters

TInt & aProcessHandleCount
TInt & aThreadHandleCount

HasCapability(TCapability, const char *)

TBool HasCapability(TCapabilityaCapability,
const char *aDiagnostic = 0
)const [inline]

Check if the process to which the thread belongs has a given capability

When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.

ETrue if the process to which the thread belongs has the capability, EFalse otherwise.

Parameters

TCapability aCapabilityThe capability to test.
const char * aDiagnostic = 0A string that will be emitted along with any diagnostic message that may be issued if the test finds the capability is not present. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system.

HasCapability(TCapability, TCapability, const char *)

TBool HasCapability(TCapabilityaCapability1,
TCapabilityaCapability2,
const char *aDiagnostic = 0
)const [inline]

Check if the process to which the thread belongs has both of the given capabilities

When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.

ETrue if the process to which the thread belongs has both the capabilities, EFalse otherwise.

Parameters

TCapability aCapability1The first capability to test.
TCapability aCapability2The second capability to test.
const char * aDiagnostic = 0A string that will be emitted along with any diagnostic message that may be issued if the test finds a capability is not present. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system.

Id()

IMPORT_C TThreadIdId()const

Kill(TInt)

IMPORT_C voidKill(TIntaReason)

Parameters

TInt aReason

Logon(TRequestStatus &)

IMPORT_C voidLogon(TRequestStatus &aStatus)const

Parameters

TRequestStatus & aStatus

LogonCancel(TRequestStatus &)

IMPORT_C TIntLogonCancel(TRequestStatus &aStatus)const

Parameters

TRequestStatus & aStatus

Open(const TDesC &, TOwnerType)

IMPORT_C TIntOpen(const TDesC &aFullName,
TOwnerTypeaType = EOwnerProcess
)

Parameters

const TDesC & aFullName
TOwnerType aType = EOwnerProcess

Open(TThreadId, TOwnerType)

IMPORT_C TIntOpen(TThreadIdaID,
TOwnerTypeaType = EOwnerProcess
)

Parameters

TThreadId aID
TOwnerType aType = EOwnerProcess

Open(const TFindThread &, TOwnerType)

TInt Open(const TFindThread &aFind,
TOwnerTypeaType = EOwnerProcess
)[inline]

Opens a handle to the thread found by pattern matching a name.

A TFindThread object is used to find all threads whose full names match a specified pattern.

By default, ownership of this thread handle is vested in the current process, but can be vested in the current thread by passing EOwnerThread as the second parameter to this function.

KErrNone if successful, otherwise one of the other system-wide error codes.

Parameters

const TFindThread & aFindA reference to the TFindThread object used to find the thread.
TOwnerType aType = EOwnerProcessAn enumeration whose enumerators define the ownership of this thread handle. If not explicitly specified, EOwnerProcess is taken as default.

Panic(const TDesC &, TInt)

IMPORT_C voidPanic(const TDesC &aCategory,
TIntaReason
)

Parameters

const TDesC & aCategory
TInt aReason

Priority()

IMPORT_C TThreadPriorityPriority()const

Process(RProcess &)

IMPORT_C TIntProcess(RProcess &aProcess)const

Parameters

RProcess & aProcess

ProcessPriority()

IMPORT_C TProcessPriorityProcessPriority()const

RenameMe(const TDesC &)

TInt RenameMe(const TDesC &aName)[static, inline]

Use User::RenameThread() instead

Parameters

const TDesC & aName

Rendezvous(TRequestStatus &)

IMPORT_C voidRendezvous(TRequestStatus &aStatus)const

Parameters

TRequestStatus & aStatus

Rendezvous(TInt)

IMPORT_C voidRendezvous(TIntaReason)[static]

Parameters

TInt aReason

RendezvousCancel(TRequestStatus &)

IMPORT_C TIntRendezvousCancel(TRequestStatus &aStatus)const

Parameters

TRequestStatus & aStatus

RequestComplete(TRequestStatus *&, TInt)

IMPORT_C voidRequestComplete(TRequestStatus *&aStatus,
TIntaReason
)const

Parameters

TRequestStatus *& aStatus
TInt aReason

RequestCount()

IMPORT_C TIntRequestCount()const

RequestSignal()

IMPORT_C voidRequestSignal()const

Resume()

IMPORT_C voidResume()const

SecureId()

IMPORT_C TSecureIdSecureId()const

Return the Secure ID of the process to which the thread belongs.

If an intended use of this method is to check that the Secure ID is a given value, then the use of a TSecurityPolicy object should be considered. E.g. Instead of something like:

		RThread& thread;
		TInt error = thread.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied;

this could be used;

		RThread& thread;
		static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId);
		TBool pass = mySidPolicy().CheckPolicy(thread);

This has the benefit that the TSecurityPolicy::CheckPolicy methods are configured by the system wide Platform Security configuration. I.e. are capable of emitting diagnostic messages when a check fails and/or the check can be forced to always pass.

TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) const

_LIT_SECURITY_POLICY_S0

The Secure ID.

SetPriority(TThreadPriority)

IMPORT_C voidSetPriority(TThreadPriorityaPriority)const

Parameters

TThreadPriority aPriority

SetProcessPriority(TProcessPriority)

IMPORT_C voidSetProcessPriority(TProcessPriorityaPriority)const

Parameters

TProcessPriority aPriority

StackInfo(TThreadStackInfo &)

IMPORT_C TIntStackInfo(TThreadStackInfo &aInfo)const

Parameters

TThreadStackInfo & aInfo

Suspend()

IMPORT_C voidSuspend()const

Terminate(TInt)

IMPORT_C voidTerminate(TIntaReason)

Parameters

TInt aReason

VendorId()

IMPORT_C TVendorIdVendorId()const

Return the Vendor ID of the process to which the thread belongs.

If an intended use of this method is to check that the Vendor ID is a given value, then the use of a TSecurityPolicy object should be considered. E.g. Instead of something like:

		RThread& thread;
		TInt error = thread.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied;

this could be used;

		RThread& thread;
		static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId);
		TBool pass = myVidPolicy().CheckPolicy(thread);

This has the benefit that the TSecurityPolicy::CheckPolicy methods are configured by the system wide Platform Security configuration. I.e. are capable of emitting diagnostic messages when a check fails and/or the check can be forced to always pass.

TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) const

_LIT_SECURITY_POLICY_V0

The Vendor ID.