SingleRequest
—asynchronous programming without active
objectsThis example shows how to issue and wait for a single request.
The example shows the general principles involved in asynchronous programming. It uses a simple wait loop and shows how the completion of asynchronous events are handled without active objects.
This example deliberately does not use active objects.
This example shows how a wait loop can be used to identify and handle a completed request.
It shows the general principles involved in asynchronous programming. It uses a simple wait loop and shows how the completion of asynchronous events are handled without active objects.
This example deliberately does not use active objects.
As with the WaitLoop example, this example shows how a wait loop can be used to identify and handle a completed request. However, this example shows how the wait loop can deal with multiple asynchronous service providers.
The example shows the general principles involved in asynchronous programming; it uses a simple wait loop and shows how the completion of asynchronous events are handled without active objects.
This example deliberately does not use active objects.
The example shows how active objects and an active scheduler can be used to handle asynchronous events. Compare this with the following examples; SingleRequest, WaitLoop and RealLifeWaitLoop.
It demonstrates a single CMessageTimer
active object
which runs until completion.
TRequestStatus
: asynchronous request
status
CActiveScheduler
: the active scheduler
CActive
: active object abstraction
CTimer
: timer base class (used here as a source
of events)
These examples show how active objects and an active scheduler can be used to handle asynchronous events.
They demonstrate a single CKeyMessengerProcessor
active object (derived from class CActiveConsole
), which accepts
input from keyboard, but does not print it. This object contains a
CMessageTimer
object which it activates if the user inputs the
character "m" and cancelled if the user inputs "c".
TRequestStatus
: asynchronous request
status
CActiveScheduler
: the active scheduler
CActive
: active object abstraction
CTimer
: timer base class (used here as a source
of events)
These examples show how active objects and an active scheduler can be used to handle asynchronous events and long-running services to maintain system responsiveness.
TRequestStatus
: asynchronous request
status
CActiveScheduler
: the active scheduler
CActive
: active object abstraction
CTimer
: timer base class (used here as a source
of events)