免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 700 | 回复: 0
打印 上一主题 下一主题

Symbian学习笔记19 之 Active Object Pitfalls [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-01-29 12:37 |只看该作者 |倒序浏览

 A stray-event panic from the Active Scheduler ( E32USER-CBASE 46 error ) is a most common problem with an Active Objects. This is ussually caused by one ( or more ) of the following:

1. You forgot to call CActiveScheduler::Add() before starting the Active Object.

2. You dont call SetActive() after issuing an async request.

3. Passing the same iStatus to two service providers at the same time ( multiple requests outstanding on the same Active Object ).

Do not invoke DoCancel() directly - it should be private - always call Cancel(). Note that Cancel() should be always be called in the destructor of your derived class.

Other related pitfalls (triggering other panics)

4. Using your own TRequestStatus variable, instead of using the one provided by CActive.

5. Passing automatic variables when doing an asynchronous request.

一、E32User-CBase 46 Panic 的成因
E32User-CBase 46 的成因除了以下大家熟知的几种情形之外,(参见 Active Object Pitfalls )
  1. 忘记将 CActive 对加入 CActiveScheduler;
  2. 在发起异步请求之后忘记调用 SetActive();
  3. 同时有两个或以上的请求使用同一个 iStatus;
  4. 没有使用 CActive 的 iStatus 成员,而是使用了 TRequestStatus 变量;
  5. 在异步请求中发送了自动变量.

AO的最常见用法:
SomeAsyncFunc(iStatus); // 提交请求
SetActive(); // 把自己设为活动状态


您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP