X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fbase%2Febase.h;h=f6fc07d3c423f6166c91e0e69a369e69ab156386;hb=0609d9f5a56c8967d913f65f2e6bf550afde4a9d;hp=cb676d0be915236e2dfc579f042880c68f238647;hpb=10e7e45ae92d4fe06f70126ed256b87896dbc432;p=vuplus_dvbapp diff --git a/lib/base/ebase.h b/lib/base/ebase.h index cb676d0..f6fc07d 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -195,6 +195,8 @@ class eMainloop int processOneEvent(unsigned int user_timeout, PyObject **res=0, ePyObject additional=ePyObject()); int retval; int m_is_idle; + int m_idle_count; + eSocketNotifier *m_inActivate; int m_interrupt_requested; timespec m_twisted_timer; // twisted timer @@ -203,13 +205,11 @@ class eMainloop void removeSocketNotifier(eSocketNotifier *sn); void addTimer(eTimer* e); void removeTimer(eTimer* e); -public: -#ifndef SWIG static ePtrList existing_loops; -#endif - + static bool isValid(eMainloop *); +public: eMainloop() - :app_quit_now(0),loop_level(0),retval(0), m_is_idle(0), m_interrupt_requested(0) + :app_quit_now(0),loop_level(0),retval(0), m_is_idle(0), m_idle_count(0), m_inActivate(0), m_interrupt_requested(0) { existing_loops.push_back(this); } @@ -239,6 +239,7 @@ public: /* m_is_idle needs to be atomic, but it doesn't really matter much, as it's read-only from outside */ int isIdle() { return m_is_idle; } + int idleCount() { return m_idle_count; } }; /** @@ -268,8 +269,9 @@ public: * * This class emits the signal \c eTimer::timeout after the specified timeout. */ -class eTimer +class eTimer: iObject { + DECLARE_REF(eTimer); friend class eMainloop; eMainloop &context; timespec nextActivation; @@ -277,6 +279,8 @@ class eTimer bool bSingleShot; bool bActive; void activate(); + + eTimer(eMainloop *context): context(*context), bActive(false) { } public: /** * \brief Constructs a timer. @@ -284,7 +288,7 @@ public: * The timer is not yet active, it has to be started with \c start. * \param context The thread from which the signal should be emitted. */ - eTimer(eMainloop *context=eApp): context(*context), bActive(false) { } + static eTimer *create(eMainloop *context=eApp) { return new eTimer(context); } ~eTimer() { if (bActive) stop(); } PSignal0 timeout; @@ -298,6 +302,7 @@ public: void changeInterval(long msek); void startLongTimer( int seconds ); bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; } + eSmartPtrList m_clients; }; #endif // SWIG