Re: [pcre-dev] Revision 922

Góra strony
Delete this message
Autor: Philip Hazel
Data:  
Dla: Giuseppe D'Angelo
CC: pcre-dev
Temat: Re: [pcre-dev] Revision 922
On Wed, 22 Feb 2012, Giuseppe D'Angelo wrote:

> I just saw the change in the commit log:
> > Set PCRE_EXTRA_USED_JIT when JIT was actually used at runtime
>
> So here's the stupid question of the day: doesn't that break
> thread-safety? Now using the same pcre_extra block in multiple threads
> causes races on who sets/clears that flag.


Not a stupid question. Thanks for asking it. Darn. I want this
functionality for pcretest. I do not want to modify the API for
pcre_exec. Is there any other way I can achieve this? (I was slightly
worried when I implemented what I did, but obviously not worried enough.
I must remember to *think threads*. :-)

OK, here is an alternative idea: if the offsets vector is large enough,
put the information in the slot after the last slot that is used. This
*could* be made conditional on an option, but (a) it does no harm, and
(b) there are only two option bits left. It's a bit kludgy, but it does
the job. (The PCRE API is already rather creaky - in the very long term
it may be necessary to re-design it completely, in which case this kind
of kludge could be tidied up.)

What do you think?

Philip

--
Philip Hazel