X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/9d3c33a84173a447eb6d9ed1519077131fdbfb63..04e48eed8c5dfc1e1a642b52ab0d03e40171e86e:/lib/base/ebase.h diff --git a/lib/base/ebase.h b/lib/base/ebase.h index 9c524ae9..c69133f6 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -155,7 +155,6 @@ private: int requested; // requested events (POLLIN, ...) void activate(int what) { /*emit*/ activated(what); } eSocketNotifier(eMainloop *context, int fd, int req, bool startnow); - void operator delete(void *pmem) { ::operator delete(pmem); } public: /** * \brief Constructs a eSocketNotifier. @@ -196,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 @@ -210,7 +211,7 @@ public: #endif 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); } @@ -240,6 +241,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; } }; /** @@ -269,8 +271,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; @@ -278,6 +281,8 @@ class eTimer bool bSingleShot; bool bActive; void activate(); + + eTimer(eMainloop *context): context(*context), bActive(false) { } public: /** * \brief Constructs a timer. @@ -285,7 +290,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; @@ -299,6 +304,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