[Python-Dev] Patch to make GIL API calls noops in single threaded applications

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Sun Oct 10 13:41:08 CEST 2004


  Can someone review my patch[1]?  It makes GIL API calls noops in
single threaded applications, i.e. if PyEval_InitThreads hasn't been
called.

  It's a very simple patch, but it makes a lot of difference if you want
to make a Python extension module thread-aware without incurring an
extra (unnecessary) performance penalty in single-threaded programs.

  Without this in Python, each extension library has to keep track of
thread state (enabled or not), and one extension library doesn't work
well with another without some explicit synchronization between the two.

  Please, we should fix this before Python 2.4 final.

  Regards.

[1] https://sourceforge.net/tracker/?
func=detail&aid=1011380&group_id=5470&atid=105470

-- 
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic



More information about the Python-Dev mailing list