]> Dogcows Code - chaz/openbox/commitdiff
no long used with our Timer-ng!
authorDana Jansens <danakj@orodu.net>
Tue, 14 Jan 2003 21:14:21 +0000 (21:14 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 14 Jan 2003 21:14:21 +0000 (21:14 +0000)
otk/timerqueue.hh [deleted file]
otk/timerqueuemanager.cc [deleted file]
otk/timerqueuemanager.hh [deleted file]

diff --git a/otk/timerqueue.hh b/otk/timerqueue.hh
deleted file mode 100644 (file)
index 5a531eb..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-#ifndef __timerqueue_hh
-#define __timerqueue_hh
-
-#ifndef   DOXYGEN_IGNORE
-
-#include "timer.hh"
-
-#include <queue>
-#include <vector>
-#include <algorithm>
-
-namespace otk {
-
-template <class _Tp, class _Sequence, class _Compare>
-class _timer_queue: protected std::priority_queue<_Tp, _Sequence, _Compare> {
-public:
-  typedef std::priority_queue<_Tp, _Sequence, _Compare> _Base;
-
-  _timer_queue(): _Base() {}
-  ~_timer_queue() {}
-
-  void release(const _Tp& value) {
-    c.erase(std::remove(c.begin(), c.end(), value), c.end());
-    // after removing the item we need to make the heap again
-    std::make_heap(c.begin(), c.end(), comp);
-  }
-  bool empty() const { return _Base::empty(); }
-  size_t size() const { return _Base::size(); }
-  void push(const _Tp& value) { _Base::push(value); }
-  void pop() { _Base::pop(); }
-  const _Tp& top() const { return _Base::top(); }
-private:
-  // no copying!
-  _timer_queue(const _timer_queue&) {}
-  _timer_queue& operator=(const _timer_queue&) {}
-};
-
-struct TimerLessThan {
-  bool operator()(const Timer* const l, const Timer* const r) const {
-    return *r < *l;
-  }
-};
-
-typedef _timer_queue<Timer*, std::vector<Timer*>, TimerLessThan> TimerQueue;
-
-}
-
-#endif // DOXYGEN_IGNORE
-
-#endif // __timerqueue_hh
diff --git a/otk/timerqueuemanager.cc b/otk/timerqueuemanager.cc
deleted file mode 100644 (file)
index e5f0a74..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-
-#ifdef    HAVE_CONFIG_H
-#  include "../config.h"
-#endif // HAVE_CONFIG_H
-
-#include "timerqueuemanager.hh"
-#include "display.hh"
-
-namespace otk {
-
-void TimerQueueManager::fire(bool wait)
-{
-  fd_set rfds;
-  timeval now, tm, *timeout = (timeval *) 0;
-
-  const int xfd = ConnectionNumber(**display);
-  
-  FD_ZERO(&rfds);
-  FD_SET(xfd, &rfds); // break on any x events
-
-  if (wait) {
-    if (! timerList.empty()) {
-      const Timer* const timer = timerList.top();
-      
-      gettimeofday(&now, 0);
-      tm = timer->remainingTime(now);
-      
-      timeout = &tm;
-    }
-
-    select(xfd + 1, &rfds, 0, 0, timeout);
-  }
-
-  // check for timer timeout
-  gettimeofday(&now, 0);
-
-  // there is a small chance for deadlock here:
-  // *IF* the timer list keeps getting refreshed *AND* the time between
-  // timer->start() and timer->shouldFire() is within the timer's period
-  // then the timer will keep firing.  This should be VERY near impossible.
-  while (! timerList.empty()) {
-    Timer *timer = timerList.top();
-    if (! timer->shouldFire(now))
-      break;
-
-    timerList.pop();
-
-    timer->fire();
-    if (timer->recurring())
-      timer->start();
-  }
-}
-
-
-void TimerQueueManager::addTimer(Timer *timer)
-{
-  assert(timer);
-  timerList.push(timer);
-}
-
-void TimerQueueManager::removeTimer(Timer* timer)
-{
-  assert(timer);
-  timerList.release(timer);
-}
-
-}
diff --git a/otk/timerqueuemanager.hh b/otk/timerqueuemanager.hh
deleted file mode 100644 (file)
index 042ede4..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-#ifndef __timerqueuemanager_hh
-#define __timerqueuemanager_hh
-
-#include "timerqueue.hh"
-
-namespace otk {
-
-//! Manages a queue of Timer objects
-/*!
-  All Timer objects add themself to a TimerQueueManager. The manager is
-  what fires the timers when their time has elapsed. This is done by having the
-  application call the TimerQueueManager::fire class in its main event loop.
-*/
-class TimerQueueManager {
-private:
-  //! A priority queue of all timers being managed by this class.
-  TimerQueue timerList;
-public:
-  //! Constructs a new TimerQueueManager
-  TimerQueueManager() {}
-  //! Destroys the TimerQueueManager
-  virtual ~TimerQueueManager() {}
-
-  //! Fire the next timer in the queue.
-  /*!
-    @param wait If true, this function will wait for the next timer, breaking
-                on any events from the X server.
-  */
-  virtual void fire(bool wait = true);
-
-  //! Adds a new timer to the queue
-  /*!
-    @param timer An Timer to add to the queue
-  */
-  virtual void addTimer(Timer* timer);
-  //! Removes a timer from the queue
-  /*!
-    @param timer An Timer already in the queue to remove
-  */
-  virtual void removeTimer(Timer* timer);
-};
-
-}
-
-#endif // __timerqueuemanager_hh
This page took 0.025334 seconds and 4 git commands to generate.