Projects

Ticket #337 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Bug in rb_source_new_timer in gcd.c

Reported by: ernest.prabhakar@… Owned by: lsansonetti@…
Priority: minor Milestone: MacRuby 0.5
Component: MacRuby Keywords:
Cc:

Description

Maybe I'm missing something, but shouldn't "&delay" be in this argument list?

rb_scan_args(argc, argv, "21", &queue, &interval, &leeway);

If not, where is delay initialized?


rb_source_new_timer(VALUE klass, SEL sel, int argc, VALUE* argv) {

dispatch_time_t start_time; VALUE queue = Qnil, interval = Qnil, delay = Qnil, leeway = Qnil; rb_scan_args(argc, argv, "21", &queue, &interval, &leeway); if (NIL_P(leeway)) {

leeway = INT2FIX(0);

} if (NIL_P(delay)) {

start_time = DISPATCH_TIME_NOW;

} else {

start_time = dispatch_walltime(NULL, number_to_nanoseconds(delay));

}

Change History

Changed 2 years ago by lsansonetti@…

You're right, looks like Patrick missed that one. Now, I'm not familiar with this GCD API so I don't know if it should be before or after leeway. Any suggestion?

Changed 2 years ago by ernest.prabhakar@…

The relevant GCD API is:

dispatch_source_set_timer(dispatch_source_t source,

dispatch_time_t start, uint64_t interval, uint64_t leeway);

Which maps into delay, interval, leeway. So, if you were following that convention it would be:

&queue, &delay, &interval, &leeway)

Changed 2 years ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed

Fixed in r3057. Note that the source APIs have not been tested/spec'ed yet.

Note: See TracTickets for help on using tickets.