Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# OsclActiveObject Class Reference
[OSCL Proc]

`#include <oscl_scheduler_ao.h>`

Inheritance diagram for OsclActiveObject:

## Public Types
enum | OsclActivePriority { EPriorityIdle = -100, EPriorityLow = -20, EPriorityNominal = 0, EPriorityHigh = 10, EPriorityHighest = 20 }
## Public Methods
OSCL_IMPORT_REF | OsclActiveObject (int32 aPriority, const char name[])
virtual OSCL_IMPORT_REF | ~OsclActiveObject ()
OSCL_IMPORT_REF void | SetBusy ()
OSCL_IMPORT_REF bool | IsBusy () const
OSCL_IMPORT_REF void | PendForExec ()
OSCL_IMPORT_REF void | PendComplete (int32 aStatus)
OSCL_IMPORT_REF void | AddToScheduler ()
OSCL_IMPORT_REF void | RemoveFromScheduler ()
OSCL_IMPORT_REF void | RunIfNotReady ()
OSCL_IMPORT_REF void | Cancel ()
OSCL_IMPORT_REF int32 | Priority () const
OSCL_IMPORT_REF int32 | Status () const
OSCL_IMPORT_REF void | SetStatus (int32)
OSCL_IMPORT_REF OsclAOStatus & | StatusRef ()
## Protected Methods
virtual OSCL_IMPORT_REF void | DoCancel ()
virtual OSCL_IMPORT_REF int32 | RunError (int32 aError)

## Detailed Description

User base class for execution objects. OsclActiveObject defines an execution object without any timer. This AO can be used across threads, i.e. the request can be activated in one thread and completed in another.

## Member Enumeration Documentation

enum OsclActiveObject::OsclActivePriority

  | Scheduling priorities. Enumeration values:
  EPriorityIdle | A low priority, useful for execution objects representing background processing.
  EPriorityLow | A priority higher than EPriorityIdle but lower than EPriorityNominal.
  EPriorityNominal | Most exec objects will have this priority.
  EPriorityHigh | A priority higher than EPriorityNominal; useful for execution objects handling user input.
  EPriorityHighest | A priority higher than EPriorityHighest.

## Constructor & Destructor Documentation

OSCL_IMPORT_REF OsclActiveObject::OsclActiveObject | ( | int32 | aPriority,
|  | const char | name[]
| ) |

  | Constructor. Parameters:
  aPriority | (input param): scheduling priority
  name | (inpup param): optional name for this AO.

virtual OSCL_IMPORT_REF OsclActiveObject::~OsclActiveObject | ( |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

OSCL_IMPORT_REF void OsclActiveObject::AddToScheduler | ( |  | ) |

| Add this exec object to the current thread's scheduler. Reimplemented from PVActiveBase.

OSCL_IMPORT_REF void OsclActiveObject::Cancel | ( |  | ) |

| Cancel any pending request. If the request is readied, this will call the DoCancel routine, wait for the request to cancel, then set the request idle. The AO will not run. If the request is not readied, it does nothing. Request must be canceled from the same thread in which it is scheduled. Reimplemented from PVActiveBase.

virtual OSCL_IMPORT_REF void OsclActiveObject::DoCancel | ( |  | ) | `[protected, virtual]`

| Cancel request handler. This gets called by scheduler when the request is cancelled. The default routine will complete the request. If any additional action is needed, the derived class may override this. If the derived class does override DoCancel, it must complete the request. Implements PVActiveBase. Reimplemented in OsclDNSRequestAO, and OsclSocketRequestAO.

OSCL_IMPORT_REF bool OsclActiveObject::IsBusy | ( |  | ) |

| Return true if this AO is pending, false otherwise.

OSCL_IMPORT_REF void OsclActiveObject::PendComplete | ( | int32 | aStatus | ) |

  | Complete the active request for the AO. This API is thread-safe. If the request is not pending, this call will leave. Parameters:
  aStatus: | request completion status.

OSCL_IMPORT_REF void OsclActiveObject::PendForExec | ( |  | ) |

| Set request active for this AO and set the status to pending. PendForExec is identical to SetActive, but it additionally sets the request status to OSCL_REQUEST_PENDING.

OSCL_IMPORT_REF int32 OsclActiveObject::Priority | ( |  | ) |

| Return scheduling priority of this exec object.

OSCL_IMPORT_REF void OsclActiveObject::RemoveFromScheduler | ( |  | ) |

| Remove this AO from its scheduler. Will leave if the calling thread context does not match the scheduling thread. Cancels any readied request before removing. Reimplemented from PVActiveBase.

virtual OSCL_IMPORT_REF int32 OsclActiveObject::RunError | ( | int32 | aError | ) | `[protected, virtual]`

  | Run Error handler. This gets called by scheduler when the Run routine leaves. The default implementation simply returns the leave code. If the derived class wants to handle errors from Run, it may override this. The RunError should return OsclErrNone if it handles the error, otherwise it should return the input error code. Parameters:
  aError: | the leave code generated by the Run.
Implements PVActiveBase.

OSCL_IMPORT_REF void OsclActiveObject::RunIfNotReady | ( |  | ) |

| Complete this AO's request immediately. If the AO is already active, this will do nothing. Will leave if the AO is not added to any scheduler, or if the calling thread context does not match the scheduling thread.

OSCL_IMPORT_REF void OsclActiveObject::SetBusy | ( |  | ) |

| Set object ready for this AO, additionally sets the request status to OSCL_REQUEST_PENDING. Will leave if the request is already readied, or the execution object is not added to any scheduler, or the calling thread context does not match the scheduler thread.

OSCL_IMPORT_REF void OsclActiveObject::SetStatus | ( | int32 |  | ) |

OSCL_IMPORT_REF int32 OsclActiveObject::Status | ( |  | ) |

| Request status access

OSCL_IMPORT_REF OsclAOStatus& OsclActiveObject::StatusRef | ( |  | ) |

The documentation for this class was generated from the following file:

- oscl_scheduler_ao.h