0 Replies Latest reply on Jul 12, 2014 7:34 PM by MarieR

    Question about swig python not releasing GIL on Windows (SWIG_PYTHON_NO_THREADS)


      Dear All,


      Examining the dbxml 2.5.16 Python wrapper generated by swig, I see that by default for Windows platforms the global interpreter lock (GIL) is not disabled as SWIG_PYTHON_NO_THREADS is defined:


      dbxml_python_wrap.cpp (line 1 --> line 11):

      #define SWIGPYTHON
      #define SWIG_DIRECTORS
      #if defined(_WIN32) || defined(__WIN32__)


      As _WIN32 is defined by default for Visual Studio 2008, the SWIG_PYTHON_NO_THREADS is set and the GIL is not released (SWIG_Python_Thread_Block is never defined and release/acquire macros are set to No-ops starting around line 979).


      Why is the GIL release disabled by default for Windows and is there any harm in changing this?


      It looks like this is being generated by a post SWIG stream editor script (distroot/dbxml/dist/swig/python_post.sed), so it would appear that someone had a reason for doing this (e.g. problem w/ Windows, or Windows version of Python).  Any insight on this would be helpful and appreciated.  If the threads were disabled due to problems with a specific Python distribution, I am using a stock 2.7.6 Python (www.pyhton.org).


      Thanks so much - Marie