From: "Ara.T.Howard" Date: 2004-03-27T01:44:31+09:00 Subject: Re: Save to use const Regexp in several threads? On Sat, 27 Mar 2004 nobu.nokada@softhome.net wrote: > Hi, > > At Fri, 26 Mar 2004 23:19:28 +0900, > Robert Klemme wrote in [ruby-talk:95917]: > > out of curiosity: is it safe to define a global constant regular > > expression and use that concurrently from several threads? I put together > > a test script that seems to indicate it is safe, but a test is no definite > > answer. > > Yes if it is without `o' option or in recent version. __without__ the 'o' - i would have thought the compile once option would be required for this since you wouldn't want all the thread re-compiling it? so you are saying pat = %r/foo/ # right pat = %r/foo/o # wrong Thread.new{ pat.match s} Thread.new{ pat.match s} ?? -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================