Szerző: Giuseppe D'Angelo Dátum: Címzett: Zoltán Herczeg CC: pcre-dev Tárgy: Re: [pcre-dev] A clarification on pcrejit docs
2012/2/22 Zoltán Herczeg <hzmester@???>: > Hi,
>
> different names are intentional, although we probably should emphasize it more.
>
> JIT stack: returned by pcre_jit_stack_alloc(). Must be freed by the user. When pcre_exec runs and uses a particular JIT stack, that must not be used by other threads until pcre_exec returns (user responsibility). You can directly assign a JIT stack to a pattern or return it through the callback. The JIT stack is used only during pcre_exec, never any other time.
>
> machine stack: when a JIT stack is not assigned or the callback returns with NULL, a function is called which defines a local variable: pcre_uint8 local_area[LOCAL_SPACE_SIZE] This area is used by the JIT in this case. LOCAL_SPACE_SIZE is 32K by default. So this is thread safe.
Hi Zoltán, thanks for the explaination.
That was exactly what I got reading "between the lines" of the
manpages -- that is, matching with JIT is thread-safe even without
setting up JIT stacks. The fact that the memory is allocated on each's
thread stack makes that thread-safe by design.