Skip to content

Instantly share code, notes, and snippets.

@Watson1978
Created May 16, 2011 00:29
Show Gist options
  • Select an option

  • Save Watson1978/973716 to your computer and use it in GitHub Desktop.

Select an option

Save Watson1978/973716 to your computer and use it in GitHub Desktop.
# test_priority
c1 = c2 = 0
t1 = Thread.new { loop { c1 += 1 } }
t1.priority = -1
t2 = Thread.new { loop { c2 += 1 } }
t2.priority = -3
assert_equal(-1, t1.priority)
assert_equal(-3, t2.priority)
sleep 0.5
5.times do
break if c1 > c2
sleep 0.1
end
t1.kill
t2.kill
@Watson1978

Copy link
Copy Markdown
Author

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00007fff60b1fc70
[Switching to process 24825 thread 0x1707]
0x00007fff8832a063 in _cache_getMethod ()
(gdb) bt
#0 0x00007fff8832a063 in _cache_getMethod ()
#1 0x00007fff88329823 in look_up_method ()
#2 0x000000010012c47a in rb_vm_dispatch () at dispatcher.cpp:635
#3 0x0000000101700a64 in ?? ()
#4 0x0000000101701554 in ?? ()
#5 0x00000001017012a1 in ?? ()
#6 0x0000000100133e8f in __rb_vm_bcall inlined at /Users/watson/src/macruby-trunk/dispatcher.cpp:98
#7 0x0000000100133e8f in vm_block_eval inlined at /Users/watson/src/macruby-trunk/dispatcher.cpp:1248
#8 0x0000000100133e8f in rb_vm_yield_args () at dispatcher.cpp:1305
#9 0x00000001000daacd in rb_vm_yield (argc=0, argv=0x0) at vm.h:700
#10 0x00000001000daa8c in rb_yield (val=6) at vm_eval.c:181
#11 0x00000001000dad97 in loop_i () at vm_eval.c:229
#12 0x00000001001480d7 in rb_rescue2 (b_proc=0x1000dad7e <loop_i>, data1=0, r_proc=0, data2=0) at vm.cpp:3747
#13 0x00000001000dae37 in rb_f_loop (rcv=8590065024, sel=0x100fe3e60) at vm_eval.c:259
#14 0x000000010012d978 in __rb_vm_rcall inlined at /Users/watson/src/macruby-trunk/dispatcher.cpp:159
#15 0x000000010012d978 in ruby_dispatch inlined at /Users/watson/src/macruby-trunk/dispatcher.cpp:466
#16 0x000000010012d978 in rb_vm_dispatch () at dispatcher.cpp:886
#17 0x0000000101700a64 in ?? ()
#18 0x00000001017010aa in ?? ()
#19 0x0000000100131dd3 in __rb_vm_bcall inlined at /Users/watson/src/macruby-trunk/dispatcher.cpp:98
#20 0x0000000100131dd3 in vm_block_eval inlined at /Users/watson/src/macruby-trunk/dispatcher.cpp:1248
#21 0x0000000100131dd3 in rb_vm_block_eval (b=0x20004cb20, argc=0, argv=0x0) at dispatcher.cpp:1255
#22 0x000000010014c60f in rb_vm_thread_run (thread=8589988096) at vm.cpp:4910
#23 0x00007fff85cb24f6 in _pthread_start ()
#24 0x00007fff85cb23a9 in thread_start ()

(gdb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment