Re: Perl5Util threadsafe for group() method?

"Duke Tantiprasut" <[email protected]> Wed, 29 Mar 2006 10:22:11 -0800
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <[email protected]>
------=_Part_5868_11485681.1143656531742
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Both will actually be the same for me. I just use the Perl5Util and dont
explicitly create matchers. The first option sounds like an easier way to g=
o
as well as being easy for most people to understand.

On 3/29/06, Daniel F. Savarese <[email protected]> wrote:
>
>
> In message <[email protected]>,
> "Duke
> Tantiprasut" 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
> 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
>
> -#-#-#-#-| Sleep and The Traveller |-#-#-#-#-#-#-#-
> http://www.savarese.org/
> In distant lands, I hear the call of my home.     #     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/          #
> http://www.savarese.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

------=_Part_5868_11485681.1143656531742--