Threads, GIL and re.match() performance

Pau Freixes pfreixes at gmail.com
Thu Jun 26 07:01:22 EDT 2008


Hi

Ok, if I understand between Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS
is not possible use a C/Python api functions ?

Sorry, but when thread enter another time with Py_END_ALLOW_THREADS this
thread enter to competition to lock GIL ?

Thks

Thks


On Thu, Jun 26, 2008 at 12:16 PM, Matthieu Brucher <
matthieu.brucher at gmail.com> wrote:

> Hi,
>
> The C-API uses references counts as well, so it is not threadsafe.
>
> Matthieu
>
> 2008/6/26 Pau Freixes <pfreixes at gmail.com>:
> > But Python C-API[1] it's the main base for extent python with C/c++, and
> > this is not not threadsafe.? I dont understand
> >
> > [1] http://docs.python.org/api/api.html
> >
> > On Thu, Jun 26, 2008 at 4:49 AM, Benjamin <musiccomposition at gmail.com>
> > wrote:
> >>
> >> On Jun 25, 9:05 am, Mirko Dziadzka <mirko.dziad... at gmail.com> wrote:
> >> >
> >> > 1) Is there a reason for this?
> >>
> >> I think it is because the Python re library uses the Python C-API
> >> which is not threadsafe.
> >> > 2) Is the regex library not thread-safe?
> >> > 3) Is it possible, to release the GIL in re.match() to
> >> >    get more performance?
> >>
> >> --
> >> http://mail.python.org/mailman/listinfo/python-list
> >
> >
> >
> > --
> > Pau Freixes
> > Linux GNU/User
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
>
>
> --
> French PhD student
> Website : http://matthieu-brucher.developpez.com/
> Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
> LinkedIn : http://www.linkedin.com/in/matthieubrucher
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Pau Freixes
Linux GNU/User
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080626/0072115a/attachment-0001.html>


More information about the Python-list mailing list