Re: Perl5Util threadsafe for group() method?
"Daniel F. Savarese" <[email protected]> Wed, 29 Mar 2006 12:15:03 -0500
| Newsgroups | gmane.comp.jakarta.oro.user |
|---|---|
| Message-ID | <[email protected]> |
In message <824028f0603270935t77ab8d97sef4e432316f6feb8=40mail.gmail.com>= , =22Duke=20 Tantiprasut=22 writes: >Is there any plans to make getMatch() and group() threadsafe? They are thread-safe. Concurrent calls to multiple methods will not leav= e the object in an inconsistent state. What I think you're asking is for the results to be thread-local/thread-specific (i.e., for the last match found by the calling thread to be returned). I'm in favor of making that= change, but it may have to be a configurable option to avoid breaking=20 existing code that depends on the existing behavior. The alternatives are to only store a thread-local match result or to also create a separat= e matcher for each thread, which may actually be the better route as it would no longer be necessary for certain (or any?) methods to be synchronized. But it would defeat the intention of having a low memory footprint (not that matchers hold a lot of state when not executing). We're not JDK 1.1 compatible anymore on account of using HashMap, so it's= safe to use ThreadLocal. Supporting J2ME would have required conditional= compilation anyway and is still easy enough to work in should the demand arise. Is there a preference for just keeping the match results thread local and= the methods synchronized or using a separate matcher for each thread without synchronization (access to the pattern cache would still have to be protected in a critical section)? daniel -=23-=23-=23-=23-=7C Sleep and The Traveller =7C-=23-=23-=23-=23-=23-=23-= =23- http://www.savarese.org/ In distant lands, I hear the call of my home. =23 s a v a r e s e= Yet my work is not done. My journey's just begun.- software research -- http://www.sleepandthetraveller.com/ =23 http://www.savarese= .com/