summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/os_core_symbian.cpp
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-07-20 08:08:30 +0000
committerBenny Prijono <bennylp@teluu.com>2007-07-20 08:08:30 +0000
commitd24a9aee403d6540ec792d3b56a1934fbc0969d4 (patch)
tree0706522f9173a479f4f3af4e6fbf1e1cddb9ef2b /pjlib/src/pj/os_core_symbian.cpp
parentc3f4bae326d9e2dfa78d23f288e822e7ae16c2db (diff)
Ticket #354: build PJLIB as dynamic libraries (.DSO) in Symbian
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1405 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/os_core_symbian.cpp')
-rw-r--r--pjlib/src/pj/os_core_symbian.cpp90
1 files changed, 88 insertions, 2 deletions
diff --git a/pjlib/src/pj/os_core_symbian.cpp b/pjlib/src/pj/os_core_symbian.cpp
index a3ec3c04..f13365a5 100644
--- a/pjlib/src/pj/os_core_symbian.cpp
+++ b/pjlib/src/pj/os_core_symbian.cpp
@@ -260,8 +260,6 @@ PJ_DEF(pj_uint32_t) pj_getpid(void)
}
-PJ_DECL(void) pj_shutdown(void);
-
/*
* pj_init(void).
* Init PJLIB!
@@ -333,6 +331,94 @@ PJ_DEF(void) pj_shutdown(void)
os->Shutdown();
}
+/////////////////////////////////////////////////////////////////////////////
+
+class CPollTimeoutTimer : public CActive
+{
+public:
+ static CPollTimeoutTimer* NewL(int msec, TInt prio);
+ ~CPollTimeoutTimer();
+
+ virtual void RunL();
+ virtual void DoCancel();
+
+private:
+ RTimer rtimer_;
+
+ explicit CPollTimeoutTimer(TInt prio);
+ void ConstructL(int msec);
+};
+
+CPollTimeoutTimer::CPollTimeoutTimer(TInt prio)
+: CActive(prio)
+{
+}
+
+
+CPollTimeoutTimer::~CPollTimeoutTimer()
+{
+ rtimer_.Close();
+}
+
+void CPollTimeoutTimer::ConstructL(int msec)
+{
+ rtimer_.CreateLocal();
+ CActiveScheduler::Add(this);
+ rtimer_.After(iStatus, msec*1000);
+ SetActive();
+}
+
+CPollTimeoutTimer* CPollTimeoutTimer::NewL(int msec, TInt prio)
+{
+ CPollTimeoutTimer *self = new CPollTimeoutTimer(prio);
+ CleanupStack::PushL(self);
+ self->ConstructL(msec);
+ CleanupStack::Pop(self);
+
+ return self;
+}
+
+void CPollTimeoutTimer::RunL()
+{
+}
+
+void CPollTimeoutTimer::DoCancel()
+{
+ rtimer_.Cancel();
+}
+
+
+/*
+ * Wait the completion of any Symbian active objects.
+ */
+PJ_DEF(pj_bool_t) pj_symbianos_poll(int priority, int ms_timeout)
+{
+ CPollTimeoutTimer *timer = NULL;
+
+ if (priority==-1)
+ priority = CActive::EPriorityStandard;
+
+ if (ms_timeout >= 0) {
+ timer = CPollTimeoutTimer::NewL(ms_timeout, priority);
+ }
+
+ PjSymbianOS::Instance()->WaitForActiveObjects(priority);
+
+ if (timer) {
+ bool timer_is_active = timer->IsActive();
+
+ if (timer_is_active)
+ timer->Cancel();
+
+ delete timer;
+
+ return timer_is_active ? PJ_TRUE : PJ_FALSE;
+
+ } else {
+ return PJ_TRUE;
+ }
+}
+
/*
* pj_thread_register(..)