[haiku-bugs] Re: [Haiku] #4576: There should be a BTimer

  • From: "stippi" <trac@xxxxxxxxxxxx>
  • Date: Tue, 15 Jun 2010 09:39:11 -0000

#4576: There should be a BTimer
----------------------------------+-----------------------------------------
 Reporter:  joeyadams             |       Owner:  nobody     
     Type:  enhancement           |      Status:  new        
 Priority:  normal                |   Milestone:  Unscheduled
Component:  Kits/Application Kit  |     Version:             
 Keywords:                        |   Blockedby:             
    Patch:  1                     |    Platform:  All        
 Blocking:                        |  
----------------------------------+-----------------------------------------

Comment(by stippi):

 In the current form, the patch provides these adventages over
 BMessageRunner:

  * Finer granularity,
  * With the callback version, one does not need a BHandler/BLooper as the
 target for the timer events.

 Recently, we've been discussing a possibility how the first problem could
 be fixed for BMessageRunner while significantly reducing the overhead (no
 extra thread). Not introducing another API is of course more elegant. It
 would not offer the callback feature, but perhaps this one is tricky
 anyway, since the callback is called in the timer thread. Application
 developers may not be expecting this, since it's not what happens in other
 frameworks like Qt or Gtk.

 As for the code of the patch, it indeed does not follow the coding style,
 but it also has too little error checking for my taste. For example the
 indication of the running of the timer and quitting of the thread is error
 prone. Instead of checking the running variable, it could instead check an
 error from acquiring the semaphore. Then the master thread could destroy
 the semaphore and then also wait for the timer thread to exit, which is
 another problem of the patch. I also think the BTimerList should be
 internal.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/4576#comment:5>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: