Ticket #796 (closed defect: invalid)
Dispatch::Queue.main created with a different Queue class?!?
| Reported by: | ernest.prabhakar@… | Owned by: | lsansonetti@… |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | MacRuby | Keywords: | |
| Cc: |
Description
The "Dispatch::Queue.main" fails the equality check in gcd.c, even though it appears identical.
$ macruby -r dispatch -e 'Dispatch::Job.new {sleep 1}.join(Dispatch::Queue.main) {puts "!"}'
/Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/1.9.2/dispatch/job.rb:28:in `join:': expected class of [0x2000c1160] to be Dispatch::Queue [0x20004c8a0], but got Dispatch::Queue [0x2000c1120] (ArgumentError)
from /Users/Shared/MacRuby-trunk/-e:1:in `<main>'
That is, the reported name is the same, but the pointer differs.
Ruby itself seems to think the classes are the same:
$ macruby -r dispatch -e "p Dispatch::Queue.main.class == Dispatch::Queue.concurrent.class" true
Concurrent queues work fine:
$ macruby -r dispatch -e 'Dispatch::Job.new {sleep 1}.join(Dispatch::Queue.concurrent) {puts "!"}'
as do private queues:
$ macruby -r dispatch -e 'Dispatch::Job.new {sleep 1}.join(Dispatch::Queue.new("1")) {puts "!"}'
I don't know if the problems is the class-equality check, or how the main queue gets a class assigned.

