SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Handle class for a threaded runnable object. More...
#include <rw/thread/RWThreadSelf.h>
Static Public Member Functions | |
static bool | canGetMaxThreads () |
static bool | canSuspendResume () |
static size_t | getMaxThreads () |
Protected Member Functions | |
RWThreadSelf (const RWThread &second) | |
Protected Member Functions inherited from RWRunnableSelf | |
RWRunnableSelf (const RWRunnable &second) | |
Protected Member Functions inherited from RWRunnableHandle | |
RWRunnableHandle () | |
RWRunnableHandle (const RWRunnableHandle &second) | |
RWRunnableHandle (RWRunnableImp *runnableImpP) | |
RWRunnableHandle (RWStaticCtor) | |
~RWRunnableHandle () | |
RWRunnableHandle & | operator= (const RWRunnableHandle &second) |
Protected Member Functions inherited from RWHandleBase | |
RWHandleBase (const RWHandleBase &second) | |
RWHandleBase (RWBodyBase *body) | |
RWHandleBase (RWStaticCtor) | |
RWHandleBase (void) | |
~RWHandleBase (void) | |
RWBodyBase & | body (void) const |
RWHandleBase & | operator= (const RWHandleBase &second) |
Friends | |
class | RWThread |
Related Symbols | |
(Note that these are not member symbols.) | |
RWThreadSelf | rwThread () |
Related Symbols inherited from RWRunnableSelf | |
RWRunnableSelf | rwRunnable () |
void | rwSleep (unsigned long milliseconds) |
void | rwYield () |
The RWThreadSelf class is a handle class for a threaded runnable object, providing an interface for threads that execute inside the threaded runnable.
A threaded runnable object provides the basic mechanisms used to create, control, and monitor the threads of execution within your application. Threaded runnables create their own thread to perform some task or activity.
Each threaded runnable object is reference-counted; a threaded runnable body instance keeps a count of the number of handles that currently reference it. A runnable object is deleted when the last handle that references the body is deleted.
A threaded runnable handle class instance may be empty. Any attempt to use an empty handle to access a threaded runnable produces an RWTHRInvalidPointer exception.
The public interface for a threaded runnable is provided by its handle classes. Many of the public functions in a handle simply forward control to a corresponding protected function in the body class.
The RWThreadSelf class provides an interface for the thread executing inside of a threaded runnable. It defines the member functions that may only be executed only by the internal thread. Threads executing outside of a threaded runnable should access the runnable using the RWThread handle class. Functions available from either inside or outside of a threaded runnable are defined in both handle classes.
To retrieve an RWThreadSelf handle instance for the current threaded runnable, use the rwThread() function. You may also convert an RWThread handle to an RWThreadSelf handle by calling the RWThread::getRWThreadSelf() member, but any attempt to violate the thread access restrictions imposed by the separate interfaces generally results in an RWTHRIllegalAccess exception.
|
inline |
Creates an empty RWThreadSelf handle. Until this object is bound to a threaded runnable, its isValid() member returns false
.
|
inline |
Constructs a global static handle instance, that may be assigned to before construction. The static constructor does not change the instance state.
|
inline |
Copy constructor. Creates an RWThreadSelf object associated with the same thread (if any) associated with second.
|
inline |
Destructor.
|
protected |
Conversion constructor.
|
static |
Returns true
if the getMaxThreads() function is supported in the current environment, otherwise false
.
bool RWThreadSelf::canGetPriority | ( | ) | const |
Each "canGetXxx"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "getXxx"
function can return a legal value under the current circumstances.
For example, canGetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling related functions such as getPriority() and getMaxPriority() can return a legal value under the current circumstances.
Possible exceptions include RWTHRInvalidPointer and RWTHRInternalError.
bool RWThreadSelf::canGetProcessScopePriority | ( | ) | const |
Each "canGetXxx"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "getXxx"
function can return a legal value under the current circumstances.
For example, canGetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling related functions such as getPriority() and getMaxPriority() can return a legal value under the current circumstances.
Possible exceptions include RWTHRInvalidPointer and RWTHRInternalError.
bool RWThreadSelf::canGetSchedulingPolicy | ( | ) | const |
Each "canGetXxx"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "getXxx"
function can return a legal value under the current circumstances.
For example, canGetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling related functions such as getPriority() and getMaxPriority() can return a legal value under the current circumstances.
Possible exceptions include RWTHRInvalidPointer and RWTHRInternalError.
bool RWThreadSelf::canGetSystemScopePriority | ( | ) | const |
Each "canGetXxx"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "getXxx"
function can return a legal value under the current circumstances.
For example, canGetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling related functions such as getPriority() and getMaxPriority() can return a legal value under the current circumstances.
Possible exceptions include RWTHRInvalidPointer and RWTHRInternalError.
bool RWThreadSelf::canGetTimeSliceQuantum | ( | ) | const |
Each "canGetXxx"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "getXxx"
function can return a legal value under the current circumstances.
For example, canGetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling related functions such as getPriority() and getMaxPriority() can return a legal value under the current circumstances.
Possible exceptions include RWTHRInvalidPointer and RWTHRInternalError.
bool RWThreadSelf::canSetPriority | ( | ) | const |
Each "canSetXxx()"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "setXxx()"
function is callable under the current circumstances.
For example, canSetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling setPriority() is supported under the current options. In addition, the function returns true
only if both the calling thread and process have sufficient privileges to perform the requested operation.
bool RWThreadSelf::canSetProcessScopePriority | ( | ) | const |
Each "canSetXxx()"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "setXxx()"
function is callable under the current circumstances.
For example, canSetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling setPriority() is supported under the current options. In addition, the function returns true
only if both the calling thread and process have sufficient privileges to perform the requested operation.
bool RWThreadSelf::canSetSchedulingPolicy | ( | RWSchedulingPolicy | policy | ) | const |
Each "canSetXxx()"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "setXxx()"
function is callable under the current circumstances.
For example, canSetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling setPriority() is supported under the current options. In addition, the function returns true
only if both the calling thread and process have sufficient privileges to perform the requested operation.
bool RWThreadSelf::canSetSystemScopePriority | ( | ) | const |
Each "canSetXxx()"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "setXxx()"
function is callable under the current circumstances.
For example, canSetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling setPriority() is supported under the current options. In addition, the function returns true
only if both the calling thread and process have sufficient privileges to perform the requested operation.
bool RWThreadSelf::canSetTimeSliceQuantum | ( | ) | const |
Each "canSetXxx()"
function returns true
if the corresponding attribute is supported in the current environment and if the corresponding "setXxx()"
function is callable under the current circumstances.
For example, canSetPriority() returns true
only if RW_THR_HAS_PRIORITY
is defined and calling setPriority() is supported under the current options. In addition, the function returns true
only if both the calling thread and process have sufficient privileges to perform the requested operation.
|
static |
Returns true
if the current environment supports the suspend() and RWThread::resume() members functions, otherwise false
.
RWThreadAttribute RWThreadSelf::getActiveAttribute | ( | ) | const |
Returns a handle to the thread attribute instance used to initialize the most recently created thread. If a thread has not yet been created, this function simply returns a copy of a default thread attribute instance.
Possible exceptions include RWTHRInvalidPointer and RWTHRInternalError.
RWThreadAttribute RWThreadSelf::getAttribute | ( | ) | const |
Returns a handle to the thread attribute object used to initialize any threads created by future calls to RWThread::start(). Use getActiveAttribute() to get a copy of the attribute instance actually used to initialize the most recently started thread.
Possible exceptions include RWTHRInvalidPointer and RWTHRInternalError.
RWPriority RWThreadSelf::getMaxPriority | ( | ) | const |
Returns the maximum priority value that may be specified for this thread. At runtime, use canGetPriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
RWPriority RWThreadSelf::getMaxProcessScopePriority | ( | ) | const |
Returns the maximum process-scope priority value that may be specified for this thread. At runtime, use canGetProcessScopePriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_PROCESS_SCOPE_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
RWPriority RWThreadSelf::getMaxSystemScopePriority | ( | ) | const |
Returns the maximum system-scope priority value that may be specified for this thread. At runtime, use canGetSystemScopePriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_SYSTEM_SCOPE_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
|
static |
Returns the maximum number of threads that may be created in this environment. This function is not supported in all environments. At runtime, use canGetMaxThreads() to determine whether this feature is available. At compile time, check to see if RW_THR_HAS_MAX_THREADS
is defined.
Possible exceptions include RWTHROperationNotSupported.
unsigned long RWThreadSelf::getMaxTimeSliceQuantum | ( | ) | const |
Returns the maximum time-slice quantum value that may be specified for this thread. At runtime, use canGetTimeSliceQuantum() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_TIME_SLICE_QUANTUM
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
RWPriority RWThreadSelf::getMinPriority | ( | ) | const |
Returns the minimum priority value that may be specified for this thread. At runtime, use canGetPriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
RWPriority RWThreadSelf::getMinProcessScopePriority | ( | ) | const |
Returns the minimum process-scope priority value that may be specified for this thread. At runtime, use canGetProcessScopePriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_PROCESS_SCOPE_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
RWPriority RWThreadSelf::getMinSystemScopePriority | ( | ) | const |
Returns the minimum system-scope priority value that may be specified for this thread. At runtime, use canGetSystemScopePriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_SYSTEM_SCOPE_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError. and RWTHRInternalError.
unsigned long RWThreadSelf::getMinTimeSliceQuantum | ( | ) | const |
Returns the minimum time-slice quantum value that may be specified for this thread. At runtime, use canGetTimeSliceQuantum() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_TIME_SLICE_QUANTUM
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
RWPriority RWThreadSelf::getPriority | ( | ) | const |
Returns the current priority for the active thread associated with self. At runtime, use canGetPriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHRThreadNotActive, and RWTHRInternalError.
RWPriority RWThreadSelf::getProcessScopePriority | ( | ) | const |
Returns the current process-scope priority for the active thread associated with self. At runtime, use canGetProcessScopePriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_PROCESS_SCOPE_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
RWThread RWThreadSelf::getRWThread | ( | ) | const |
Returns an external thread interface associated with the same thread, if any, associated with self.
RWSchedulingPolicy RWThreadSelf::getSchedulingPolicy | ( | ) | const |
Returns the current scheduling policy for the active thread associated with self. At runtime, use canGetSchedulingPolicy() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_SCHEDULING_POLICY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHRThreadNotActive, and RWTHRInternalError.
RWPriority RWThreadSelf::getSystemScopePriority | ( | ) | const |
Returns the current system-scope priority for the active thread associated with self. At runtime, use canGetSystemScopePriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_SYSTEM_SCOPE_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
unsigned long RWThreadSelf::getTimeSliceQuantum | ( | ) | const |
Returns the current time-slice quantum value for the active thread associated with self. At runtime, use canGetTimeSliceQuantum() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_TIME_SLICE_QUANTUM
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, and RWTHRInternalError.
|
inline |
Assignment operator. Binds the handle to the same threaded runnable, if any, pointed-to by second.
void RWThreadSelf::setAttribute | ( | const RWThreadAttribute & | second | ) |
Replaces the thread attribute instance used to initialize any threads created by future calls to RWThread::start(). Changing a thread's attribute object after the thread has been started does not affect its current thread.
Possible exceptions include RWTHRInvalidPointer and RWTHRInternalError.
void RWThreadSelf::setPriority | ( | RWPriority | priority | ) |
Changes the priority of thread associated with self. At runtime, use canSetPriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, RWTHRBoundsError, RWTHRResourceLimit, and RWTHRInternalError.
void RWThreadSelf::setProcessScopePriority | ( | RWPriority | priority | ) |
Changes the process-scope priority of the thread associated with self. At runtime, use canSetProcessScopePriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_PROCESS_SCOPE_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, RWTHRBoundsError, RWTHRResourceLimit, and RWTHRInternalError.
void RWThreadSelf::setSchedulingPolicy | ( | RWSchedulingPolicy | policy | ) |
Changes the scheduling policy of the thread associated with self. At runtime, use canSetSchedulingPolicy%(policy) to determine the availability of this feature. At compile time check to see if RW_THR_HAS_SCHEDULING_POLICY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, RWTHRBoundsError, RWTHRResourceLimit, and RWTHRInternalError.
void RWThreadSelf::setSystemScopePriority | ( | RWPriority | priority | ) |
Changes the system-scope priority of the thread associated with self. At runtime, use canSetSystemScopePriority() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_SYSTEM_SCOPE_PRIORITY
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, RWTHRBoundsError, RWTHRResourceLimit, and RWTHRInternalError.
void RWThreadSelf::setTimeSliceQuantum | ( | unsigned long | milliseconds | ) |
Changes the time-slice quantum value of the thread associated with self. At runtime, use canSetTimeSliceQuantum() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_TIME_SLICE_QUANTUM
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHROperationNotAvailable, RWTHRThreadNotActive, RWTHRBoundsError, RWTHRResourceLimit, and RWTHRInternalError.
unsigned RWThreadSelf::suspend | ( | ) |
Suspends the execution of the thread associated with self until a matching RWThread::resume() operation is performed.
At runtime, use canSuspendResume() to determine the availability of this feature. At compile time, check to see if RW_THR_HAS_SUSPEND_RESUME
is defined.
Possible exceptions include RWTHRInvalidPointer, RWTHROperationNotSupported, RWTHRThreadNotActive, and RWTHRInternalError.
|
related |
This function returns the internal thread handle, of type RWThreadSelf, associated with the current thread (if any). It will return an empty RWThreadSelf handle if the current thread was not started by a Threads Module threaded runnable object. The returned thread handle should be tested for validity, by using the isValid() member, if the code calling the function does not know that it is running in a thread started by a Threads Module thread object.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |