Re: [pcre-dev] PCRE2 and thread safety of jit compilation?

Kezdőlap
Üzenet törlése
Szerző: Zoltán Herczeg
Dátum:  
Címzett: Giuseppe D'Angelo
CC: pcre-dev
Tárgy: Re: [pcre-dev] PCRE2 and thread safety of jit compilation?
>lock(mutex);
>extra = pcre_study(code, ...);
>unlock(mutex);
>/* then proceed to match as usual */


you can do this now as well. Just replace pcre_study to pcre2_jit_compile. There is no need to check JIT availability, the call will return with an error in that case (and you can silently ignore it). If other threads use the same pattern, they use the interpreted match until the compilation is done ("done" means an atomic write operation).

Regards,
Zoltan