Class CThreadIt 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:
CWorkPackIt - This class describes the work to be performed.
CWorkPackIt - This class describes the results of the work.
CThreadIt - 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 CThreadIt 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.
This project uses the following libraries:
Log for C++ is a library of C++ classes for flexible logging to files, syslog and other destinations. It is modeled after the Log for Java library (http://jakarta.apache.org/log4j/), staying as close to their API as is reasonable. UnitTest++ is a lightweight unit testing framework for C++. It was designed to do test-driven development on a wide variety of platforms. Simplicity, portability, speed, and small footprint are all very important aspects of UnitTest++. UnitTest++ is mostly standard C++ and makes minimal use of advanced library and language features, which means it should be easily portable to just about any platform. Out of the box, the following platforms are supported:- Windows
- Linux
- Mac OS X