X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/5518d56f51a8951cc7cea96ee1782ba470380ddc..325d00ce4ba8a2b239b0837e878d5c2721e5682a:/lib/base/ebase.h diff --git a/lib/base/ebase.h b/lib/base/ebase.h index f14d07ac..bab1b5f3 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -191,6 +191,7 @@ class eMainloop int processOneEvent(unsigned int user_timeout, PyObject **res=0, ePyObject additional=ePyObject()); int retval; int time_offset; + int m_is_idle; pthread_mutex_t recalcLock; int m_interrupt_requested; @@ -211,16 +212,19 @@ public: #endif eMainloop() - :app_quit_now(0),loop_level(0),retval(0), m_interrupt_requested(0) + :app_quit_now(0),loop_level(0),retval(0), m_is_idle(0), m_interrupt_requested(0) { existing_loops.push_back(this); pthread_mutex_init(&recalcLock, 0); } - ~eMainloop() + virtual ~eMainloop() { existing_loops.remove(this); pthread_mutex_destroy(&recalcLock); + for (std::map::iterator it(notifiers.begin());it != notifiers.end();++it) + it->second->stop(); } + int looplevel() { return loop_level; } #ifndef SWIG @@ -242,6 +246,9 @@ public: PyObject *poll(SWIG_PYOBJECT(ePyObject) dict, SWIG_PYOBJECT(ePyObject) timeout); void interruptPoll(); void reset(); + + /* 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; } }; /**