=== modified file 'plugins/feature/rip/rip.cpp'
--- plugins/feature/rip/rip.cpp	2009-10-04 12:23:21 +0000
+++ plugins/feature/rip/rip.cpp	2009-10-31 16:33:10 +0000
@@ -65,8 +65,6 @@
 void RippingThread::run() {
     RipConfig *rip_conf = S_RipConfig::get_instance();
 
-    ScreenUpdater *screen_updater = S_ScreenUpdater::get_instance();
-
     Rip *rip = get_class<Rip>(dgettext("mms-rip", "CD-Ripper"));
 
     if (!rip) {
@@ -75,9 +73,6 @@
 
     if (rip->cdpd) {
         rip->ripping_active = true;
-        rip->Notify(true);
-        screen_updater->timer.del("rip");
-        screen_updater->timer.add(TimeElement("rip", boost::bind( &Rip::check_rip_print, rip), boost::bind(&Rip::print, rip)));
 
         if (rip->RipCD()) {
             DialogWaitPrint pdialog(2000);
@@ -92,12 +87,17 @@
             pdialog.add_line(dgettext("mms-rip", "Ripping failed"));
             pdialog.print();
         }
-        rip->ripping_active = false;
-        rip->Notify(false);
-        screen_updater->timer.del("rip");
+
+	rip->ripping_active = false;
     }
 }
 
+void Rip::finished_ripping()
+{
+  Notify(false);
+  screen_updater->timer.del("rip");
+}
+
 #ifdef use_notify_area
 void Rip::ShowNotifyArea() {
     string strMsg;
@@ -258,6 +258,7 @@
         delete cdtag;
     }
     delete ripping_thread;
+    finished_ripping();
 }
 
 void Rip::Notify(bool on) {
@@ -276,6 +277,7 @@
         return 500; // ms
     } else {
         rip_on_off = false;
+	finished_ripping();
         return 20000;
     }
 }
@@ -933,7 +935,14 @@
         cdtag->DownloadCDCover(cover_fullpath.c_str());
 
         stop_ripping = false;
+
         ripping_thread->start();
+
+        Notify(true);
+        screen_updater->timer.del("rip");
+        screen_updater->timer.add(TimeElement("rip", boost::bind( &Rip::check_rip_print, rip), 
+					      boost::bind(&Rip::print, rip)));
+	
     }
 }
 

=== modified file 'plugins/feature/rip/rip.hpp'
--- plugins/feature/rip/rip.hpp	2009-09-25 16:02:03 +0000
+++ plugins/feature/rip/rip.hpp	2009-10-31 16:31:04 +0000
@@ -59,6 +59,8 @@
     void startup_updater() {
     }
 
+    void finished_ripping();
+
     void toggle_track();
     void select_all();
     void deselect_all();

=== modified file 'plugins/input/input.cpp'
--- plugins/input/input.cpp	2009-05-10 12:29:22 +0000
+++ plugins/input/input.cpp	2009-10-31 16:14:21 +0000
@@ -164,7 +164,14 @@
 
   Input input;
 
-  input_ready.wait();
+  S_ScreenUpdater::get_instance()->run();
+  S_BackgroundUpdater::get_instance()->run();
+
+  while (!input_ready.wait(50)) {
+    S_ScreenUpdater::get_instance()->run();
+    S_BackgroundUpdater::get_instance()->run();
+  }
+
   input_ready.reset();
 
   inputs_mutex.enterMutex();

=== modified file 'updater.cpp'
--- updater.cpp	2009-10-12 20:12:10 +0000
+++ updater.cpp	2009-10-31 16:14:21 +0000
@@ -15,7 +15,7 @@
 using std::list;
 using namespace time_helper;
 #define min_wait_time 20
-#define max_wait_time 1000
+#define max_wait_time 500
 
 
 pthread_mutex_t ScreenUpdater::singleton_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -26,10 +26,7 @@
     total_progressbar(0), header(""), updater_name("Updater"),
     quitting(false), running(false)
 {
-  timer.hold_timers();
-  /* start the updater thread */
-  pthread_create(&thread_run, NULL, (void *(*)(void *))(pre_run), this);
-  timer.release_timers();
+  clock_gettime(CLOCK_REALTIME, &tnext);
 }
 
 Updater::~Updater(){
@@ -39,10 +36,7 @@
 
 void Updater::activate()
 {
-  int rc = pthread_mutex_lock(&timer.elements_mut);
   running = true;
-  if (rc != EDEADLK) /* we unlock and signal only if this thread has locked the mutex once */
-    timer.release_timers();
 }
 
 void Updater::deactivate()
@@ -52,70 +46,33 @@
 
 void Updater::quit()
 {
-  timer.hold_timers();
   if (quitting){
-    timer.release_timers();
     /* fprintf(stderr, "Updater::quit() was called twice\n"); */
     return;
   }
   quitting = true;
-  timer.release_timers();
-  pthread_join(thread_run, NULL);
 }
 
 void Updater::run_once(const boost::function<void (void)>& func)
 {
-  int rc = pthread_mutex_lock(&timer.elements_mut);
   run_once_functions.push_back(func);
-  if (rc != EDEADLK) /* we unlock and signal only if this thread has locked the mutex once */
-    timer.release_timers();
-}
-
-void * Updater::pre_run(void * ptr){
-  Updater * thisobj = reinterpret_cast<Updater*>(ptr);
-  thisobj->run();
-  return 0;
 }
 
 void Updater::run()
 {
-  timer.elements_bool = false;
-  pthread_mutex_lock(&timer.elements_mut);
-  struct timespec ts = compute_interval(max_wait_time);
-  int ret;
-  uint64_t next_timeout = 0;
-  //fprintf(stderr, "Updater thread initted\n");
-  while (!quitting ){
-    ret = pthread_cond_timedwait(&timer.elements_switch,
-         &timer.elements_mut, &ts);
-    
-    if (!running){
-      ts = compute_interval(max_wait_time);
-      continue;
-    }
-    else if (quitting)
-      break;
-    
-    if (ret != ETIMEDOUT && !timer.elements_bool)
-      continue; /* we're not finished waiting */
-    
-    timer.elements_bool = false;
-    
-    /* If we're here it means that either timer has elapsed for some event
-    *  or another thread has added/removed an event */
-
-    std::list<boost::function<void (void)> > old_run_once_functions = run_once_functions;
-    run_once_functions.clear();
-    pthread_mutex_unlock(&timer.elements_mut);
-    foreach (boost::function<void (void)>& func, old_run_once_functions)
-      func();
-    pthread_mutex_lock(&timer.elements_mut);
-
-    clock_gettime(CLOCK_REALTIME, &ts);
-    
-    uint64_t ms_now = static_cast<uint64_t>(ts.tv_sec)*1000 + ts.tv_nsec/1000000;
-    uint64_t diff = max_wait_time;
-    next_timeout = diff;
+  struct timespec tnow;
+  clock_gettime(CLOCK_REALTIME, &tnow);
+
+  if (diff_timeval(tnow, tnext) > 0)
+    return;
+  
+  std::list<boost::function<void (void)> > old_run_once_functions = run_once_functions;
+  run_once_functions.clear();
+  foreach (boost::function<void (void)>& func, old_run_once_functions)
+    func();
+
+  uint64_t diff = max_wait_time;
+  uint64_t next_timeout = max_wait_time;
 
     /* We might have to call routines that mess with timer.elements.
      * This might lead to undefined behaviours, crashes, and lots of unpleasant stuff.
@@ -130,16 +87,14 @@
 
 	assert (thiselement_id > 0);
 
-        diff = diff_timeval(ts, element.next_time);
+        uint64_t diff = diff_timeval(tnow, element.next_time);
 	if (diff < 5){ /* less than 5 milliseconds is so marginal that it is not worth waiting till next loop */
-	  pthread_mutex_unlock(&timer.elements_mut);
 	  element.callback();
-	  pthread_mutex_lock(&timer.elements_mut);
 	  diff = element.time();
 	/*  fprintf(stderr, "Updater '%s':: Returned from Timer element '%s' (wants a %lld ms timeout)\n",
 	      updater_name.c_str(),
 	      element.name.c_str(), diff);*/ 
-	  element.next_time = compute_interval(ts, diff); 
+	  element.next_time = compute_interval(tnow, diff); 
 
 	  /* Let's update the next_time value of the "official" TimeElement if  it is still there */
 	  list<TimeElement>::iterator real_element = timer.elements.begin();
@@ -165,11 +120,7 @@
 
     /* fprintf(stderr, "Updater '%s':: Will sleep for %lld ms (timeout at %lld)\n",
 	updater_name.c_str(), next_timeout, ms_now + next_timeout); */
-    ts = compute_interval(ts, next_timeout);
-  }
-
-  /* thread ends here */
-  pthread_mutex_unlock(&timer.elements_mut);
+    tnext = compute_interval(tnow, next_timeout);
 }
 
 uint64_t Updater::diff_timeval(const struct timespec& t1, const struct timespec& t2)
@@ -182,94 +133,40 @@
   return b-a;
 }
 
-Updater::Timer::Timer(){
-
-  pthread_mutexattr_t mta;
-
-  pthread_mutexattr_init(&mta);
-
-  pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK);
-
-  pthread_mutex_init(&elements_mut, &mta);
-
-  pthread_mutexattr_destroy(&mta); /* we don't need it anymore */
-
-  pthread_cond_init(&elements_switch, NULL);
-
+Updater::Timer::Timer()
+{
   lastelement_id = 0;
 }
-Updater::Timer::~Timer(){
-  pthread_mutex_destroy(&elements_mut);
-  pthread_cond_destroy(&elements_switch);
-}
-
-void Updater::Timer::hold_timers(){
-  int rc = pthread_mutex_lock(&elements_mut);
-  if (rc != 0){
-    fprintf(stderr, "Updater class: Could not lock elements_mut\n");
-    fprintf(stderr, "Updater class: Error code number %d\n", rc);
-    fprintf(stderr, "Updater class: Please report this bug\n");
-    assert(false);
-  }
-}
-
-void Updater::Timer::release_timers(){
-  elements_bool = true;
-  pthread_cond_broadcast(&elements_switch); /* wakes thread up */
-  int rc = pthread_mutex_unlock(&elements_mut);
-  if (rc != 0){
-    fprintf(stderr, "Updater class: We're unlocking elements_mut, which wasn't previously locked\n");
-    fprintf(stderr, "Updater class: Please report this bug\n");
-    assert(false);
-  }
-
-}
 
 void Updater::Timer::add(TimeElement te)
 {
   te.next_time = compute_interval(te.time());
-  int rc = pthread_mutex_lock(&elements_mut);
   te.element_id = ++lastelement_id;
   elements.push_back(te);
-  if (rc != EDEADLK) /* we unlock and signal only if this thread has locked the mutex once */
-    release_timers();
 }
 
 void Updater::Timer::del(string name)
 {
-  int rc = pthread_mutex_lock(&elements_mut);
-
   for (list<TimeElement>::iterator iter = elements.begin(), end = elements.end();
        iter != end; ++iter)
     if (iter->name == name) {
       elements.erase(iter);
       break;
     }
-
-  if (rc != EDEADLK) /* we unlock and signal only if this thread has locked the mutex once */
-    release_timers();
 }
 
 void Updater::Timer::activate(const string& name)
 {
-
-  int rc = pthread_mutex_lock(&elements_mut);
-
   foreach (TimeElement& element, elements)
     if (element.name == name) {
       element.next_time = compute_interval(element.time());
       element.active = true;
       break;
     }
-  
-  if (rc != EDEADLK) /* we unlock and signal only if this thread has locked the mutex once */
-    release_timers();
 }
 
 void Updater::Timer::deactivate(const string& name)
 {
-  int rc = pthread_mutex_lock(&elements_mut);
-
   foreach (TimeElement& element, elements)
     if (element.name == name) {
       element.active = false;
@@ -278,62 +175,37 @@
       }
       break;
     }
-
-  if (rc != EDEADLK) /* we unlock and signal only if this thread has locked the mutex once */
-    release_timers();
 }
 
 void Updater::Timer::run_and_deactivate(const string& name)
 {
-  hold_timers();
-
   foreach (TimeElement& element, elements)
     if (element.name == name) {
       element.callback();
       element.active = false;
       break;
     }
-
-  release_timers();
 }
 
 bool Updater::Timer::status(const string& name)
 {
-  int rc = pthread_mutex_lock(&elements_mut);
   bool active_element = false;
   foreach (TimeElement& element, elements)
     if (element.name == name) {
       active_element = element.active;
       break;
     }
-  if (rc != EDEADLK) /* we unlock and signal only if this thread has locked the mutex once */
-    release_timers();
   return active_element;
 }
 
 // trigger
-
-
-void Updater::Trigger::hold_timers(){
-  pthread_mutex_lock(&elements_mut);
-}
-
-void Updater::Trigger::release_timers(){
-  pthread_mutex_unlock(&elements_mut);
-}
-
-
 void Updater::Trigger::add(const TriggerElement& te)
 {
-  hold_timers();
   elements.push_back(te);
-  release_timers();
 }
 
 void Updater::Trigger::del(const string& name)
 {
-  hold_timers();
-
   for (list<TriggerElement>::iterator iter = elements.begin(), end = elements.end();
        iter != end; ++iter)
     if (iter->name == name) {
@@ -342,14 +214,11 @@
       elements.erase(iter);
       break;
     }
-  release_timers();
 }
 
 void Updater::Trigger::del_all()
 {
-  hold_timers();
   elements.clear();
-  release_timers();
 }
 
 void Updater::Trigger::trigger_input(const string& trigger)
@@ -357,8 +226,6 @@
   if (!enabled)
     return;
 
-  hold_timers();
-
   foreach (TriggerElement& element, elements) {
     if (element.triggers.size() == 1 && element.triggers.front().empty()) { // trigger
 								      // on all input
@@ -371,8 +238,6 @@
 	}
     }
   }
-
-  release_timers();
 }
 
 void Updater::Trigger::enable()
@@ -386,13 +251,7 @@
 }
 
 Updater::Trigger::Trigger()
-  : enabled(true){
-
-  pthread_mutex_init(&elements_mut, NULL);
-}
-Updater::Trigger::~Trigger(){
-  pthread_mutex_destroy(&elements_mut);
-}
+  : enabled(true){}
 
 BackgroundUpdater::BackgroundUpdater(){
   updater_name = "BackgroundUpdater";

=== modified file 'updater.hpp'
--- updater.hpp	2008-11-25 22:32:40 +0000
+++ updater.hpp	2009-10-31 16:14:21 +0000
@@ -61,7 +61,7 @@
   cleanup_func cleanup;
 };
 
-class Updater //: public ost::Thread
+class Updater
 {
 public:
   Updater();
@@ -76,11 +76,8 @@
   {
   public:
     Timer();
-    ~Timer();
     void add(TimeElement te);  /* this can be executed by code launched by Timer */
     void del(std::string name); /* this can be executed by code launched by Timer */
-    void hold_timers();
-    void release_timers();
 
     // for individual elements
     void activate(const std::string& name); /* this can be executed by code launched by Timer */
@@ -92,9 +89,6 @@
 
     std::list<TimeElement> elements;
 
-    pthread_mutex_t elements_mut;
-    pthread_cond_t  elements_switch;
-    volatile bool   elements_bool;
   private:
     uint32_t lastelement_id;
 
@@ -105,7 +99,6 @@
   {
   public:
     Trigger();
-    ~Trigger();
 
     void add(const TriggerElement& te);
     // cleanup
@@ -119,15 +112,14 @@
     void disable();
     void enable();
 
-    pthread_mutex_t elements_mut;
   private:
     bool enabled;
 
-    //ost::Mutex elements_mut;
-
     std::list<TriggerElement> elements;
   };
 
+  void run();
+
   Timer timer;
   Trigger trigger;
 
@@ -138,15 +130,12 @@
   std::string updater_name;
 private:
 
+  struct timespec tnext;
+
   uint64_t diff_timeval(const timespec&, const timespec&);
   std::list<boost::function<void (void)> > run_once_functions;
 
-  static void * pre_run(void * ptr);
-
-  void run();
-
   virtual void set_nicelevel() = 0;
-  pthread_t thread_run;
 
   volatile bool quitting;
   bool running;

