[MacRuby] #1491: Dispatch::Source.timer should not repeat if specify TIME_FOREVER to interval.
#1491: Dispatch::Source.timer should not repeat if specify TIME_FOREVER to interval. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Test Script: {{{ gcdq = Dispatch::Queue.new('sample') timer = Dispatch::Source.timer(1, Dispatch::TIME_FOREVER, 0, gcdq) do |s| puts "Wake up!" end sleep 3 }}} Result: {{{ $ macruby gcd.rb Wake up! Wake up! Wake up! Wake up! ---- snip ---- }}} I wrote same code with Objective-C, and it does not repeat. {{{ #import <Foundation/Foundation.h> int main(void) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; dispatch_queue_t queue = dispatch_queue_create("sample", NULL); dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, 1ull * NSEC_PER_SEC), DISPATCH_TIME_FOREVER, 0); dispatch_source_set_event_handler(timer, ^{ NSLog(@"Wake up"); }); dispatch_resume(timer); sleep(3); [pool release]; return 0; } }}} {{{ $ gcc gcd.m -framework Foundation $ ./a.out 2012-03-31 09:33:59.188 a.out[61445:1703] Wake up $ }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1491> MacRuby <http://macruby.org/>
#1491: Dispatch::Source.timer should not repeat if specify TIME_FOREVER to interval. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: fixed Keywords: | ----------------------------------+----------------------------------------- Changes (by watson1978@…): * status: new => closed * resolution: => fixed Comment: Fixed with https://github.com/MacRuby/MacRuby/commit/bcd996c558e4fe37c8e185c804c2459f57... -- Ticket URL: <http://www.macruby.org/trac/ticket/1491#comment:1> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby