RThread Class Reference

#include <e32std.h>

class RThread : public RHandleBase

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()
Inherited Attributes
RHandleBase::iHandle
Inherited Enumerations
RHandleBase:TAttributes
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 &)

Detailed Description

A handle to a thread.

The thread itself is a kernel object.

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 Function Documentation

Context ( TDes8 & )

IMPORT_C voidContext(TDes8 &aDes)const

Gets the register contents of this thread.

Parameters
aDesOn return, contains the register contents, starting with R0.

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

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

Creates a thread belonging to the current process, and opens this handle to that thread.

A new heap is created for this thread.

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.

If KNullDesC is specified for the name, then an anonymous thread will be created. Anonymous threads are not global, and cannot be opened by other processes.

Parameters
aNameThe name to be assigned to this thread. KNullDesC, to create an anonymous thread.
aFunctionA pointer to a function.. Control passes to this function when the thread is first resumed, i.e. when the thread is initially scheduled to run.
aStackSizeThe size of the new thread's stack. This must be at least 512 bytes, otherwise this method will fail with KErrArgument.
aHeapMinSizeThe minimum size for the new thread's heap.
aHeapMaxSizeThe maximum size for the new thread's heap.
aPtrA pointer to data to be passed as a parameter to the thread function when the thread is initially scheduled to run. If the thread function does not need any data then this pointer can be NULL. It must be ensured that the memory pointed to by this pointer is still valid when accessed by the new thread, e.g. if aPtr points to data on the stack.
aTypeAn enumeration whose enumerators define the ownership of this thread handle. If not explicitly specified, EOwnerProcess is taken as default.
Return Value
KErrNone if successful, otherwise one of the other system-wide error codes. KErrArgument if aStackSize is less than 512 bytes. KErrAlreadyExists will be returned if there is another thread in this process with the specified name.
Panic Codes
USER109 if aStackSize is negative.
USER110 if aHeapMinSize is less than KMinHeapSize.
USER111 if aHeapMaxSize is less than aHeapMinSize.

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

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

Creates a thread belonging to the current process, and opens this handle to that thread.

This thread uses the heap whose handle is pointed to by aAllocator. If this is NULL, then the thread uses the heap of the creating thread.

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.

If KNullDesC is specified for the name, then an anonymous thread will be created. Anonymous threads are not global, and cannot be opened by other processes.

Parameters
aNameThe name to be assigned to this thread. KNullDesC, to create an anonymous thread.
aFunctionA pointer to a function. Control passes to this function when the thread is first resumed, i.e. when the thread is initially scheduled to run.
aStackSizeThe size of the new thread's stack. This must be at least 512 bytes, otherwise this method will fail with KErrArgument.
aHeapA pointer to the handle of the heap belonging to another thread which this thread is to use.
aPtrA pointer to data to be passed as a parameter to the thread function when the thread is initially scheduled to run. If the thread function does not need any data, then this pointer can be NULL. It must be ensured that the memory pointed to by this pointer is still valid when accessed by the new thread, e.g. if aPtr points to data on the stack.
aTypeAn enumeration whose enumerators define the ownership of this thread handle. If not explicitly specified, EOwnerProcess is taken as default.
Return Value
KErrNone if successful otherwise one of the other system-wide error codes. KErrArgument if aStackSize is less than 512 bytes. KErrAlreadyExists will be returned if there is another thread in this process with the specified name.
Panic Codes
USER109 if aStackSize is negative.

Create ( const TThreadCreateInfo & )

IMPORT_C TIntCreate(const TThreadCreateInfo &aCreateInfo)

Creates a thread belonging to the current process, and opens this handle to that thread. The thread will have the properties as defined by the parameter aCreateInfo.

Parameters
aCreateInfoA reference to a TThreadCreateInfo object specifying the properties of thread to create.
Return Value
KErrNone if successful, otherwise one of the other system-wide error codes. KErrAlreadyExists will be returned if there is another thread in this process with the specified name.
Panic Codes
USER109 if the stack size specified for the thread is negative.
USER110 if the specified minimum heap size is less than KMinHeapSize.
USER111 if the specified maximum heap size is less than the specified minimum heap size.

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...

DeprecatedUse process emulation instead

Deprecated

ExitCategory ( )

IMPORT_C TExitCategoryNameExitCategory()const

Gets the name of the category associated with the end of the thread.

The category name together with the reason number is a way of distinguishing between different causes of thread termination.

If the thread has panicked, the category name is the panic category name; for example, E32USER-CBase or KERN-EXEC. If the thread has ended as a result of call to Kill(), then the category name is Kill.

If the thread has not ended, then the category name is empty, i.e. the length of the category name is zero.

See also: TBuf

Return Value
A TBuf descriptor with a defined maximum length containing the name of the category associated with the end of the thread.

ExitReason ( )

IMPORT_C TIntExitReason()const

Gets the specific reason associated with the end of this thread.

The reason number together with the category name is a way of distinguishing between different causes of thread termination.

If the thread has panicked, this value is the panic number. If the thread has ended as a result of a call to Kill(), then the value is the one supplied by Kill().

If the thread is still alive, then the returned value is zero.

Return Value
The reason associated with the end of the thread.

ExitType ( )

IMPORT_C TExitTypeExitType()const

Tests whether the thread has ended and, if it has ended, return how it ended.

This information allows the caller to distinguish between normal termination and a panic.

Return Value
An enumeration whose enumerators describe how the thread has ended.

GetCpuTime ( TTimeIntervalMicroSeconds & )

IMPORT_C TIntGetCpuTime(TTimeIntervalMicroSeconds &aCpuTime)const

Gets the CPU usage for this thread.

This function is not supported on version 8.0b or 8.1b, and returns KErrNotSupported. From 9.1 onwards it may be supported if the kernel has been compiled with the MONITOR_THREAD_CPU_TIME macro defined.

KErrNotSupported - if this feature is not supported on this version or build of the OS.

Parameters
aCpuTimeA reference to a time interval object supplied by the caller.
Return Value
KErrNone - if thread CPU time is available.

HandleCount ( TInt &, TInt & )

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

Gets the number of handles open in this thread, and the number of handles open in the process which owns this thread.

Parameters
aProcessHandleCountOn return, contains the number of handles open in the process which owns this thread.
aThreadHandleCountOn return, contains the number of handles open in this thread.

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.

Parameters
aCapabilityThe capability to test.
aDiagnosticA 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.
Return Value
ETrue if the process to which the thread belongs has the capability, EFalse otherwise.

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.

Parameters
aCapability1The first capability to test.
aCapability2The second capability to test.
aDiagnosticA 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.
Return Value
ETrue if the process to which the thread belongs has both the capabilities, EFalse otherwise.

Id ( )

IMPORT_C TThreadIdId()const

Gets the Id of this thread.

Return Value
The Id of this thread.

Kill ( TInt )

IMPORT_C voidKill(TIntaReason)

Ends the thread, specifying a reason code.

This function is dangerous and should be used only in cases where the target thread cannot end itself via the normal methods of calling User::Exit() or completing its thread function. A hypothetical example might be where a thread gets 'stuck' in a third-party DLL.

The target thread gets no opportunity to execute any clean-up code, therefore incautious use of this function may lead to memory leaks.

It is functionally identical to RThread::Terminate(), the only difference between the two is a legacy distinction between a 'normal' reason for exiting (use Kill) and an 'abnormal' reason (use Terminate). The choice of function is reflected in the return value of RThread::ExitType().

The thread must be in the current process otherwise a panic is raised.

If the thread is process permanent, or the thread is the last thread in the process, then the process is also killed. If the thread is system permanent, the entire system is rebooted.

WARNING: If the target thread uses a shared heap then use of this function will cause an internal array used for thread-local storage (TLS) to be leaked. This leak is specific to ARM platforms which implement the CP15 feature and will not occur on other platforms.

See also: User::Exit() User::SetCritical() User::Critical() RThread::Terminate() RThread::ExitType()

Parameters
aReasonThe reason to be associated with the ending of this thread.

Logon ( TRequestStatus & )

IMPORT_C voidLogon(TRequestStatus &aStatus)const

Requests notification when this thread dies, normally or otherwise.

A request for notification is an asynchronous request, and completes:

A request for notification requires memory to be allocated; if this is unavailable, then the call to Logon() returns, and the asynchronous request completes immediately.

Note that even when a thread has died, it is not possible to create a new thread with the same name until all handles on the dead thread have been closed. If this is attempted, the call to RThread::Create will fail with KErrAlreadyExists.

See also: RThread::LogonCancel() RThread::ExitReason() RThread::Create()

Parameters
aStatusA reference to the request status object. This contains the reason code describing the reason for the termination of the thread, i.e. the value returned by a call to RThread::ExitReason(). Alternatively, this is set to: KErrCancel, if an outstanding request is cancelled; KErrNoMemory, if there is insufficient memory to deal with the request.

LogonCancel ( TRequestStatus & )

IMPORT_C TIntLogonCancel(TRequestStatus &aStatus)const

Cancels an outstanding request for notification of the death of this thread.

A request for notification must previously have been made, otherwise the function returns KErrGeneral.

The caller passes a reference to the same request status object as was passed in the original call to Logon().

Parameters
aStatusA reference to the same request status object used in the original call to Logon().
Return Value
KErrGeneral, if there is no outstanding request, KErrNone otherwise.

Open ( const TDesC &, TOwnerType )

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

Opens a handle to specifically named thread.

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.

Parameters
aFullNameA reference to the descriptor containing the full name of the thread that is already running.
aTypeAn enumeration whose enumerators define the ownership of this thread handle. If not explicitly specified, EOwnerProcess is taken as default.
Return Value
KErrNone, if successful, otherwise one of the other system-wide error codes.

Open ( TThreadId, TOwnerType )

IMPORT_C TIntOpen(TThreadIdaID,
TOwnerTypeaType = EOwnerProcess
)

Opens a handle to the thread with a specific thread Id.

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.

Parameters
aIDThe thread Id used to find the thread.
aTypeAn enumeration whose enumerators define the ownership of this thread handle. If not explicitly specified, EOwnerProcess is taken as default.
Return Value
KErrNone, if successful, otherwise one of the other system-wide error codes.

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.

Parameters
aFindA reference to the TFindThread object used to find the thread.
aTypeAn enumeration whose enumerators define the ownership of this thread handle. If not explicitly specified, EOwnerProcess is taken as default.
Return Value
KErrNone if successful, otherwise one of the other system-wide error codes.

Panic ( const TDesC &, TInt )

IMPORT_C voidPanic(const TDesC &aCategory,
TIntaReason
)

Panics this thread, specifying the panic category name and reason.

The length of the category name should be no greater than 16; any name with a length greater than 16 is truncated to 16.

The calling thread, i.e. the thread in which this function is called, must be in the same process as this target thread, otherwise the calling thread is itself panicked.

If the thread is process critical or process permanent, the process also panics. If the thread is system critical or system permanent, the entire system is rebooted.

See also: User::SetCritical() User::Critical()

Parameters
aCategoryA reference to the descriptor containing the text which defines the category name for this panic.
aReasonThe panic number.
Panic Codes
KERN-EXEC46 if this target thread's process is not the same as the calling thread's process.

Priority ( )

IMPORT_C TThreadPriorityPriority()const

Gets the priority of this thread.

Return Value
The priority.

Process ( RProcess & )

IMPORT_C TIntProcess(RProcess &aProcess)const

Opens a process-relative handle to the process which owns this thread.

The caller must construct a default RProcess object and pass this to the function. On return, aProcess is the open process-relative handle to the process owning this thread.

The return value indicates the success or failure of this function.

Parameters
aProcessA reference to a default RProcess handle; on successful return from this function, this is the process-relative handle to the process which owns this thread.
Return Value
KErrNone, if successful, otherwise one of the other system-wide error codes.

ProcessPriority ( )

IMPORT_C TProcessPriorityProcessPriority()const

Gets the priority of the process which owns this thread.

Return Value
The process priority.

RenameMe ( const TDesC & )

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

DeprecatedUse User::RenameThread() instead

Rendezvous ( TRequestStatus & )

IMPORT_C voidRendezvous(TRequestStatus &aStatus)const

Creates a Rendezvous request with the thread.

The request is an asynchronous request, and completes:

Note that a request requires memory to be allocated; if this is unavailable, then this call to Rendezvous() returns, and the asynchronous request completes immediately.

See also: RThread::Rendezvous(TInt aReason) RThread::RendezvousCancel(TRequestStatus& aStatus)

Parameters
aStatusA reference to the request status object. The Rendezvous completes normally when RThread::Rendezvous(TInt aReason) is called, and this request status object will contain this reason code. If the thread exits or panics, then this is the thread exit reason value, i.e. the same value returned by RThread::ExitReason(). Alternatively, this is set to: KErrCancel, if an outstanding request is cancelled; KErrNoMemory, if there is insufficient memory to deal with the request.

Rendezvous ( TInt )

IMPORT_C voidRendezvous(TIntaReason)[static]

Completes all Rendezvous' with the current thread.

See also: RThread::Rendezvous(TRequestStatus& aStatus)

Parameters
aReasonThe reason code used to complete all rendezvous requests

RendezvousCancel ( TRequestStatus & )

IMPORT_C TIntRendezvousCancel(TRequestStatus &aStatus)const

Cancels a previously requested Rendezvous with the thread

The request completes with the value KErrCancel (if it was still outstanding).

See also: RThread::Rendezvous(TRequestStatus& aStatus)

Parameters
aStatusA reference to the same request status object used in the original call to Rendezvous(TRequestStatus& aStatus).
Return Value
KErrGeneral, if there is no outstanding request, KErrNone otherwise.

RequestComplete ( TRequestStatus *&, TInt )

IMPORT_C voidRequestComplete(TRequestStatus *&aStatus,
TIntaReason
)const

Signals this thread that an asynchronous request originating from this thread, is complete.

The request is associated with the specified request status object supplied by this thread.

Typically, the caller of this function is the service provider responsible for satisfying the request made by this thread.

The request is completed with the completion code passed in aReason. This value is copied into this thread's request status, *aStatus, before signalling this thread's request semaphore.

The meaning of the completion code is a matter of convention to be decided between the service provider and this thread.

In a client-server situation, completion of a request takes place in the context of the server thread, but the pointer is interpreted in the address space of the client.

It is often the case in client-server situations that the client and the server are in the same address space (i.e. the same process).

Setting the pointer to the request status to NULL is a convenience, not all servers need it.

Parameters
aStatusA reference to a pointer to the request status originally supplied by this thread. This is a pointer into this thread's address space, which may be different to the thread currently executing (this code). On return, the pointer to the request status is set to NULL.
aReasonThe completion code of this request.

RequestCount ( )

IMPORT_C TIntRequestCount()const

Gets this thread's request semaphore count.

The request semaphore is created when a thread is created, and is used to support asynchronous requests.

A negative value implies that this thread is waiting for at least one asynchronous request to complete.

Return Value
This thread's request semaphore count.

RequestSignal ( )

IMPORT_C voidRequestSignal()const

Signal this threads request semaphore.

This is similar to RThread::RequestComplete() except that no TRequestStatus object is modified.

May only be used to signal a thread in the same process as the callers.

Panic Codes
KERN-EXEC46 if the thread is not in the same process as the callers

Resume ( )

IMPORT_C voidResume()const

Makes the thread eligible for execution.

After a thread is created, it is put into a suspended state; the thread is not eligible to run until Resume() is called.

This function must also be called to resume execution of this thread after it has been explicitly suspended by a call to Suspend().

Note that when a thread is created, it is given the priority EPriorityNormal by default. The fact that a thread is initially put into a suspended state means that the thread priority can be changed by calling the thread's SetPriority() member function before the thread is started by a call to Resume().

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.

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

Return Value
The Secure ID.

SetPriority ( TThreadPriority )

IMPORT_C voidSetPriority(TThreadPriorityaPriority)const

Sets the priority of the thread to one of the values defined by the TThreadPriority enumeration.

The resulting absolute priority of the thread depends on the value of aPriority and the priority of the owning process.

Use of the priority value EPriorityNull is restricted to Symbian OS, and any attempt to explicitly set this value causes a KERN-EXEC 14 panic to be raised.

Parameters
aPriorityThe priority value.
Panic Codes
KERN-EXEC14, if aPriority is invalid or set to EPriorityNull
KERN-EXEC46, if aPriority is EPriorityAbsoluteRealTime1 or higher and calling process does not have ProtServ capability
Capability
ProtServif aPriority is EPriorityAbsoluteRealTime1 or higher

SetProcessPriority ( TProcessPriority )

IMPORT_C voidSetProcessPriority(TProcessPriorityaPriority)const

Sets the priority of the process which owns this thread to one of the values defined by the TProcessPriority enumeration.

The priority can be set to one of the four values:

EPriorityLow

EPriorityBackground

EPriorityForeground

EPriorityHigh

The absolute priority of all threads owned by the process (and all threads owned by those threads etc.) are re-calculated.

Note:

The use of the priority values EPriorityWindowServer, EPriorityFileServer, EPriorityRealTimeServer and EPrioritySupervisor is restricted to Symbian OS, and any attempt to explicitly set any of these priority values raises a KERN-EXEC 14 panic.

DeprecatedNot allowed on threads in a different process. Replace with RProcess::SetPriority or RMessagePtr2::SetProcessPriority

Parameters
aPriorityThe priority value.

StackInfo ( TThreadStackInfo & )

IMPORT_C TIntStackInfo(TThreadStackInfo &aInfo)const

Gets information about a thread's user mode stack.

See also: TThreadStackInfo

Parameters
aInfoThe TThreadStackInfo object to write the stack infomation to.
Return Value
KErrNone, if sucessful; KErrGeneral, if the thread doesn't have a user mode stack, or it has terminated.

Suspend ( )

IMPORT_C voidSuspend()const

Suspends execution of this thread.

The thread is not scheduled to run until a subsequent call to Resume() is made.

Terminate ( TInt )

IMPORT_C voidTerminate(TIntaReason)

Ends the thread, specifying a reason code.

This function is dangerous and should be used only in cases where the target thread cannot end itself via the normal methods of calling User::Exit() or completing its thread function. A hypothetical example might be where a thread gets 'stuck' in a third-party DLL.

The target thread gets no opportunity to execute any clean-up code, therefore incautious use of this function may lead to memory leaks.

It is functionally identical to RThread::Kill(), the only difference between the two is a legacy distinction between a 'normal' reason for exiting (use Kill) and an 'abnormal' reason (use Terminate). The choice of function is reflected in the return value of RThread::ExitType().

The thread must be in the current process otherwise a panic is raised.

If the thread is process critical or process permanent, or the thread is the last thread in the process, then the process is also terminated. If the thread is system critical or system permanent, the entire system is rebooted.

WARNING: If the target thread uses a shared heap then use of this function will cause an internal array used for thread-local storage (TLS) to be leaked. This leak is specific to ARM platforms which implement the CP15 feature and will not occur on other platforms.

See also: User::Exit() User::SetCritical() User::Critical() RThread::Kill() RThread::ExitType()

Parameters
aReasonThe reason to be associated with the ending of this thread.

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.

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

Return Value
The Vendor ID.