Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TTaskHandle
Inherited By:
None.
Purpose:
TTaligentTaskHandle is a wrapper for a task. A task consists of an address space and a collection of one or more cooperating threads. Destroying a TTaligentTaskHandle object does not destroy the task it represents. New tasks can be created by calling specific forms of the TTaligentTaskHandle constructor. TTaligentTaskHandle can be used to query the status of a task and control its state.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
Do not derive any classes from TTaligentTaskHandle.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
Other Considerations:
TTaligentTaskHandle inherits its behavior for operator== from TTaskHandle.
The class TTaskHandle specifies that two objects that are is-a TTaskHandle, either directly or indirectly, return true on operator== if and only if both objects refer to the same underlying task. For example, consider the following code fragment:
TTaskHandle me1(TTaskHandle::kUseCurrentThread); // get current task
TTaligentTaskHandle me2(TTaligentTaskHandle::kUseCurrentTask): // get current task
if (me1 ==me2) printf("Same task, in spite of different representations!\n");
if (me2 ==me1) printf("Same task, in spite of different representations!\n");
TTaligentTaskHandle inherits its behavior for Hash, Exists, Kill, and WaitForDeathOf from TTaskHandle.
virtual ~TTaligentTaskHandle()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
static void GetTaskSet (TCollectionOf < TTaligentTaskHandle > & where)
Interface Category:
API.
Purpose:
Fills in a collection of all tasks currently on the system. It is the callers responsibility to free the allocated memory.
Calling Context:
Call this member function to obtain all the TTaligentTaskHandle's in the current sess ion.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
W A R N I N G ! : Caller is responsible for deleting objects returned in co llection!!
virtual TThreadHandle CreateThread (const TThreadProgram & whatToRun)
Interface Category:
API.
Purpose:
Create a new thread in the task. Execute the specified TThreadProgram in that task.
Calling Context:
This member function is used to create a thread in another address space.
Parameters:
- const TThreadProgram& whatToRun -Specifies the program to stream to the targe t task, and run.
Return Value:
Return the TThreadHandle of the thread executing in the target task.
Exceptions:
Throws any exceptions caused by Prepare member function in whatToRun.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual TStream & operator >>=(TStream & toWhere) const
Interface Category:
API.
Purpose:
Stream out a TTaligentTaskHandle Object to a TMessageStream.
Calling Context:
Called when the task handle needs to be written to a stream.
Parameters:
- TStream& toWhere -Specifies the stream to write to.
Return Value:
Return the output stream.
Exceptions:
Throws exception if there is a problem with the stream.
Throws an exception if you write to a stream class that doesn't support stre aming of tasks.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual TStream & operator <<= (TStream & fromWhere)
Interface Category:
API.
Purpose:
Stream in a TTaligentTaskHandle object to a TMessageStream.
Calling Context:
Called when the task handle needs to be read from a stream.
Parameters:
- TStream& fromWhere -Specifies the stream to read from.
Return Value:
Return the input stream.
Exceptions:
Throws exception if there is a problem with the stream.
Throws an exception if you read from a stream class that doesn't support str eaming of tasks.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TTaligentTaskHandle & operator =(const TTaligentTaskHandle & sourceHandle)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Call this
Parameters:
Return Value:
Reference to this task.
Exceptions:
Passes through exceptions from assignment operator on base class TTaskHandle.
An exception may be thrown if the task no longer exists.
Concurrency:
Not multithread safe.
Other Considerations:
None.
- TTaligentTaskHandle (const TThreadProgram & whatToRun)
- TTaligentTaskHandle (EExecutionTask)
- TTaligentTaskHandle (const TTaligentTaskHandle & aTask)
- TTaligentTaskHandle ()
Interface Category:
API.
Purpose:
- Creates a new thread in the task. Executes the specified TThreadProgram in that task.
- Wraps task of currently executing thread. Use the following enum: enum EExecutionTask { kUseCurrentTask };
- Makes a copy of another TTaligentTaskHandle.
- Default constructor for streaming into.
Calling Context:
- This member function is used to create a thread in another address space.
- Use this constructor when you want to obtain a handle to the current task.
- Use this copy constructor to make copy of a task handle.
- Call this prior to stream in.
Parameters:
- const TThreadProgram & whatToRun -Specifies the program to stream to the target task, and run.
- EExecutionTask -Specifies to use the current task.
- const TTaligentTaskHandle & aTask -Specifies the task to copy.
- Takes no parameters.
Return Value:
#1 Returns the TThreadHandle of the thread executing in the target task.
#2-4 - None.
Exceptions:
Passes through exceptions from copy constructor on base class TTaskHandle.
An exception may be thrown if the task no longer exists.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.