あ伊藤です.

Thread の中で Curses.getch を使おうとしたのですが,
何か恐いことが起きてるみたいです.curses を thread
といっしょに使うと呪われるのでしょうか?

例:test.rb

require 'curses'

Thread.new do
  x = Curses.getch
end

sleep 10

exit

実行:

aito@condor [ruby-1.1c6]% ./ruby ../ruby/test.rb
../ruby/curstest.rb:4: [BUG] Segmentation fault
Abort

aito@condor [ruby-1.1c6]% gdb ruby
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.5.1"...
(gdb) r ../ruby/curstest.rb
Starting program: /u56/aito/amuse/ruby-1.1c6/ruby ../ruby/test.rb

Program received signal SIGSEGV, Segmentation fault.
0xef658d80 in wgetch ()
(gdb) bt
#0  0xef658d80 in wgetch ()
#1  0xef6514e4 in curses_getch (obj=771808) at curses.c:347
#2  0x207a0 in rb_call0 (klass=771712, recv=771808, id=8121, argc=0, argv=0x0, 
    body=0xbbca8, nosuper=1) at eval.c:3384
#3  0x21300 in rb_call (klass=771712, recv=771808, mid=8121, argc=0, argv=0x0, 
    scope=0) at eval.c:3657
#4  0x1d0c8 in rb_eval (self=829840, node=0xbc980) at eval.c:2007
#5  0x1da10 in rb_eval (self=829840, node=0xbc950) at eval.c:2149
#6  0x1f714 in rb_yield_0 (val=767344, self=829840) at eval.c:2925
#7  0x1f838 in rb_yield (val=767344) at eval.c:2962
#8  0x26340 in thread_yield (arg=0, th=0xf5dd8) at eval.c:6322
#9  0x261d8 in thread_create (fn=0x26324 <thread_yield>, arg=0x0) at eval.c:6287
#10 0x26380 in thread_start () at eval.c:6331
#11 0x207a0 in rb_call0 (klass=808720, recv=808768, id=3073, argc=0, argv=0x0, 
    body=0xc56f8, nosuper=1) at eval.c:3384
#12 0x21300 in rb_call (klass=808720, recv=808768, mid=3073, argc=0, argv=0x0, 
    scope=0) at eval.c:3657
#13 0x1d0c8 in rb_eval (self=829840, node=0xbc9c8) at eval.c:2007
#14 0x1c5f0 in rb_eval (self=829840, node=0xbc908) at eval.c:1796
#15 0x1bea8 in rb_eval (self=829840, node=0xbc8c0) at eval.c:1616
#16 0x1a794 in eval_node (self=829840) at eval.c:929
#17 0x1a850 in ruby_run () at eval.c:959
#18 0x19618 in main (argc=2, argv=0xeffff474, envp=0xeffff480) at main.c:32
(gdb)  up
#1  0xef6514e4 in curses_getch (obj=771808) at curses.c:347
347         return CHR2FIX(getch());
(gdb) list
342     /* def getch */
343     static VALUE
344     curses_getch(obj)
345         VALUE obj;
346     {
347         return CHR2FIX(getch());
348     }
349     
350     /* def getstr */
351     static VALUE
(gdb)

--
aito