Changeset 1405 for pjproject/trunk/pjlib/src/pj/os_core_symbian.cpp
- Timestamp:
- Jul 20, 2007 8:08:30 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/os_core_symbian.cpp
r1269 r1405 261 261 262 262 263 PJ_DECL(void) pj_shutdown(void);264 265 263 /* 266 264 * pj_init(void). … … 332 330 PjSymbianOS *os = PjSymbianOS::Instance(); 333 331 os->Shutdown(); 332 } 333 334 ///////////////////////////////////////////////////////////////////////////// 335 336 class CPollTimeoutTimer : public CActive 337 { 338 public: 339 static CPollTimeoutTimer* NewL(int msec, TInt prio); 340 ~CPollTimeoutTimer(); 341 342 virtual void RunL(); 343 virtual void DoCancel(); 344 345 private: 346 RTimer rtimer_; 347 348 explicit CPollTimeoutTimer(TInt prio); 349 void ConstructL(int msec); 350 }; 351 352 CPollTimeoutTimer::CPollTimeoutTimer(TInt prio) 353 : CActive(prio) 354 { 355 } 356 357 358 CPollTimeoutTimer::~CPollTimeoutTimer() 359 { 360 rtimer_.Close(); 361 } 362 363 void CPollTimeoutTimer::ConstructL(int msec) 364 { 365 rtimer_.CreateLocal(); 366 CActiveScheduler::Add(this); 367 rtimer_.After(iStatus, msec*1000); 368 SetActive(); 369 } 370 371 CPollTimeoutTimer* CPollTimeoutTimer::NewL(int msec, TInt prio) 372 { 373 CPollTimeoutTimer *self = new CPollTimeoutTimer(prio); 374 CleanupStack::PushL(self); 375 self->ConstructL(msec); 376 CleanupStack::Pop(self); 377 378 return self; 379 } 380 381 void CPollTimeoutTimer::RunL() 382 { 383 } 384 385 void CPollTimeoutTimer::DoCancel() 386 { 387 rtimer_.Cancel(); 388 } 389 390 391 /* 392 * Wait the completion of any Symbian active objects. 393 */ 394 PJ_DEF(pj_bool_t) pj_symbianos_poll(int priority, int ms_timeout) 395 { 396 CPollTimeoutTimer *timer = NULL; 397 398 if (priority==-1) 399 priority = CActive::EPriorityStandard; 400 401 if (ms_timeout >= 0) { 402 timer = CPollTimeoutTimer::NewL(ms_timeout, priority); 403 } 404 405 PjSymbianOS::Instance()->WaitForActiveObjects(priority); 406 407 if (timer) { 408 bool timer_is_active = timer->IsActive(); 409 410 if (timer_is_active) 411 timer->Cancel(); 412 413 delete timer; 414 415 return timer_is_active ? PJ_TRUE : PJ_FALSE; 416 417 } else { 418 return PJ_TRUE; 419 } 334 420 } 335 421
Note: See TracChangeset
for help on using the changeset viewer.