Upload
swain
View
64
Download
2
Embed Size (px)
DESCRIPTION
活动对象. 主要内容. 活动对象机制 活动对象的使用 用活动对象处理复杂事务. 活动对象机制. 活动对象框架 活动对象调度器 CActiveScheduler class CActiveScheduler : public CBase { friend class CActiveSchedulerWait; public: struct TLoop; typedef TLoop* TLoopOwner; public: IMPORT_C CActiveScheduler(); IMPORT_C ~CActiveScheduler(); - PowerPoint PPT Presentation
Citation preview
活动对象
主要内容活动对象机制活动对象的使用用活动对象处理复杂事务
活动对象机制 活动对象框架
活动对象调度器 CActiveScheduler class CActiveScheduler : public CBase
{friend class CActiveSchedulerWait;
public:struct TLoop;typedef TLoop* TLoopOwner;
public:IMPORT_C CActiveScheduler();IMPORT_C ~CActiveScheduler();IMPORT_C static void Install(CActiveScheduler* aScheduler);IMPORT_C static void Add(CActive* aActive);IMPORT_C static void Start();IMPORT_C static void Stop();... ...};
活动对象机制 活动对象框架
活动对象类 CActive class CActive : public CBase { public: IMPORT_C ~CActive(); IMPORT_C void Cancel(); ... ... protected: IMPORT_C CActive(TInt aPriority); IMPORT_C void SetActive(); virtual void DoCancel() =0; virtual void RunL() =0; IMPORT_C virtual TInt RunError(TInt
aError); public: TRequestStatus iStatus; };
活动对象机制活动对象的生命周期及操作顺序
活动对象的使用实现活动对象的必要步骤
( 1 )从 CActive 类派生活动对象类( 2 )实现活动对象类的构造函数 ( 3 )实现活动对象的二阶段构造函数 Const
ructL() ( 4 )实现 CActive 类的三个虚函数 RunL() 、
DoCancel() 、 RunError() ( 5 )实现活动对象的析构函数
用活动对象处理复杂事务活动对象的 RunL() 方法不能长时间占用 CPU
把复杂大任务分割成许多小任务进行处理