Class ThreadIt supports the asynchronous model of an active object that can accept request to do work within a thread of control and return the result of the work processing. Work requests are accepted and stored in a buffer until the thread is able to perform the work associated with the request. Completed work requests (the result of the work) are buffered until the requestor is able to retrieve the result. The model requires the following classes:
WorkPackIt - This class describes the work to be performed.
WorkPackIt - This class describes the results of the work.
ThreadIt - Implements the model that defines how clients are able to execute work in separate thread.
Derived Class - Defines the processing to perform in response to work requests.
As an example, class ThreadIt can be used to provide a separate thread of execution to perform processing on behalf of clients with a processing completion notification being sent to the client. This would find use when a User Interface must perform a lengthy process that may tie up the screen response. The processing may be delegated to an instance derived from this class for execution in separate thread thus not impacting on the user response. When work is complete the User Interface is notified and retrieves the work done from the work output queue.
Another use case on the server is to accept incoming requests with the ability to check the incoming queue size and then take action if the processing is taking to long and the request queue is increasing in size.