ACT::autonomous_act Class Reference

Base class for ACT that may initiate background activity and require notification. More...

#include <ACT.hpp>

Inheritance diagram for ACT::autonomous_act:

ACT::basic_act ACT::Basic_Listening_Task< Listener, Monitor > ACT::Basic_Listening_Task< ACT::N_to_completion, ACT::N_to_completion_Monitor > ACT::Service< Aspect > ACT::Service< Supplied_Service_Aspect > IO::Behavior IO::Old_Device_Generator IO::read_action_base IO::Sink IO::Source IO::Stream_Consumer IO::write_action_base

List of all members.

Public Member Functions

ACT_State operator() (wakeup_listener *w)
ACT_State operator() ()
 Convenience zero-parameter operator() ;.

Protected Member Functions

virtual ACT_State run (wakeup_listener *)=0
 This is the body of the ACT. It is reasonable to consider this as an analogue of a thread body. This is the variety of the body that may initiate autonomous activity that sends asynchronous notice of completion.

Friends

class act
 Facade class has direct access to avoid indirecting status calls.


Detailed Description

Base class for ACT that may initiate background activity and require notification.

Member Function Documentation

virtual ACT_State ACT::autonomous_act::run ( wakeup_listener  )  [protected, pure virtual]

This is the body of the ACT. It is reasonable to consider this as an analogue of a thread body. This is the variety of the body that may initiate autonomous activity that sends asynchronous notice of completion.

Precondition:
  • the_state == Working. (Note: the proxy for this function in the facade class enforces this.)
Postcondition:
Note:
The postcondition is not a guarantee that a wakeup_listener will be called, but rather that a reliance upon the caller that this instance may call the listener (assuming it's not null). Certain ACT's may provide such a guarantee that they will call. They might do this by, for example, registering with the OS for a notification when I/O is available.

The input parameter wakeup_listener may indeed be zero. The intent behind this choice is to enable a scheduler to forbid an ACT from setting up a background poll or notification. Should a scheduler do this, it must assume the responsibility for checking back later.

This choice support changing scheduling policy under various load conditions. Under low load, outside notification is preferable, since the alternative is a de facto polling loop, constantly running the ACT and seeing if it completes. This simply uses up CPU. Under high load, however, when CPU usage is near maximum, polling and notification code simply adds overhead. In this situation, a scheduler might skip notification and switch over to a "least recently executed" policy for selecting the next ACT to run. Furthermore, these policies might be blended, putting "slow" operations into notification mode and "fast" operations into direct retry mode.
See also:
ACT_State: For more detailed information on the meaning of the return value.

Implemented in ACT::Service< Aspect >, cygnal::HTTP::HTTP_Behavior, IO::SSource, IO::SSink, IO::Stream_Consumer, IO::Old_String_Generator, Net::read_action, Net::write_action, and ACT::Service< Supplied_Service_Aspect >.

ACT_State ACT::autonomous_act::operator() ( wakeup_listener w  )  [inline, virtual]

Implements ACT::basic_act.

ACT_State ACT::autonomous_act::operator() ( void   )  [inline, virtual]

Convenience zero-parameter operator() ;.

Implements ACT::basic_act.


Friends And Related Function Documentation

friend class act [friend]

Facade class has direct access to avoid indirecting status calls.


The documentation for this class was generated from the following file:
Generated on Thu Mar 6 18:25:09 2008 for Gnash by  doxygen 1.5.4