also use refcounting for eTimers
[enigma2.git] / lib / base / ebase.h
index cb676d0be915236e2dfc579f042880c68f238647..c86c177ddd08e79e592143bbe7956620b041c556 100644 (file)
@@ -155,6 +155,7 @@ 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.
@@ -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,9 @@ class eTimer
        bool bSingleShot;
        bool bActive;
        void activate();
+
+       eTimer(eMainloop *context): context(*context), bActive(false) { }
+       void operator delete(void *pmem) { ::operator delete(pmem); }
 public:
        /**
         * \brief Constructs a timer.
@@ -284,7 +289,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<void> timeout;
@@ -298,6 +303,7 @@ public:
        void changeInterval(long msek);
        void startLongTimer( int seconds );
        bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; }
+       eSmartPtrList<iObject> m_clients;
 };
 #endif  // SWIG