From: "David A. Black" Date: 2008-09-06T07:10:46+09:00 Subject: [ruby-core:18465] Re: Global constants and other magic in 1.9 stdlib Hi -- On Sat, 6 Sep 2008, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:18461] Re: Global constants and other magic in 1.9 stdlib" > on Sat, 6 Sep 2008 01:03:04 +0900, Paul Brannan writes: > > |$_ is thread-local, but $? really is global: > | > | rb_define_readonly_variable("$?", &rb_last_status); > | > |I'm sure there's a good reason, but I don't know what it is. (maybe > |something to do with calling Process.wait from a signal handler?) > > Since $? is a result from waitpid, which is not always bound to a > thread. I'm wondering if I'm misinterpreting this as thread-local $? behavior, and if it isn't, then what's accounting for the two $?'s: >> t = Thread.new { system("ddddd"); Thread.stop; puts $? } => # >> system("date") Fri Sep 5 18:12:32 EDT 2008 => true >> $? => # >> t.run => # pid 343 exit 127 David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates!