You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by nl...@apache.org on 2005/09/13 22:36:03 UTC

svn commit: r280650 - in /httpd/mod_python/trunk: src/include/mpversion.h src/mod_python.c test/httpdconf.py test/test.py

Author: nlehuen
Date: Tue Sep 13 13:35:57 2005
New Revision: 280650

URL: http://svn.apache.org/viewcvs?rev=280650&view=rev
Log:
Fixed : APR_HAS_THREADS ends with an 'S'. Reintroduced the calls to PyEval_AcquireLock and PyEval_ReleaseLock as they are required if threading is enabled. Removed two debugging log entries. Added the conditional commenting of the LockFile directive in the LockFile class.

Modified:
    httpd/mod_python/trunk/src/include/mpversion.h
    httpd/mod_python/trunk/src/mod_python.c
    httpd/mod_python/trunk/test/httpdconf.py
    httpd/mod_python/trunk/test/test.py

Modified: httpd/mod_python/trunk/src/include/mpversion.h
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/include/mpversion.h?rev=280650&r1=280649&r2=280650&view=diff
==============================================================================
--- httpd/mod_python/trunk/src/include/mpversion.h (original)
+++ httpd/mod_python/trunk/src/include/mpversion.h Tue Sep 13 13:35:57 2005
@@ -1,5 +1,5 @@
 #define MPV_MAJOR 3
 #define MPV_MINOR 2
 #define MPV_PATCH 0
-#define MPV_BUILD 20050912
-#define MPV_STRING "3.2.0-dev-20050912"
+#define MPV_BUILD 20050913
+#define MPV_STRING "3.2.0-dev-20050913"

Modified: httpd/mod_python/trunk/src/mod_python.c
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/mod_python.c?rev=280650&r1=280649&r2=280650&view=diff
==============================================================================
--- httpd/mod_python/trunk/src/mod_python.c (original)
+++ httpd/mod_python/trunk/src/mod_python.c Tue Sep 13 13:35:57 2005
@@ -31,7 +31,7 @@
  * (In a Python dictionary) */
 static PyObject * interpreters = NULL;
 
-#ifdef APR_HAS_THREAD
+#if APR_HAS_THREADS
 static apr_thread_mutex_t* interpreters_lock = 0;
 #endif
 
@@ -129,9 +129,12 @@
     if (! name)
         name = MAIN_INTERPRETER;
 
-#ifdef APR_HAS_THREAD
+#if APR_HAS_THREADS
     apr_thread_mutex_lock(interpreters_lock);
 #endif
+#ifdef WITH_THREAD
+    PyEval_AcquireLock();
+#endif
 
     if (!interpreters) {
          ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, srv,
@@ -157,7 +160,10 @@
         idata = (interpreterdata *)PyCObject_AsVoidPtr(p);
     }
 
-#ifdef APR_HAS_THREAD
+#ifdef WITH_THREAD
+    PyEval_ReleaseLock();
+#endif
+#if APR_HAS_THREADS
     apr_thread_mutex_unlock(interpreters_lock);
 #endif
 
@@ -513,10 +519,8 @@
         /* initialze the interpreter */
         Py_Initialize();
 
-#ifdef APR_HAS_THREAD
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, s, "just before");
+#if APR_HAS_THREADS
         apr_thread_mutex_create(&interpreters_lock, APR_THREAD_MUTEX_UNNESTED, p);
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, s, "just after");
 #endif
 #ifdef WITH_THREAD
         /* create and acquire the interpreter lock */

Modified: httpd/mod_python/trunk/test/httpdconf.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/httpdconf.py?rev=280650&r1=280649&r2=280650&view=diff
==============================================================================
--- httpd/mod_python/trunk/test/httpdconf.py (original)
+++ httpd/mod_python/trunk/test/httpdconf.py Tue Sep 13 13:35:57 2005
@@ -130,7 +130,11 @@
 
 class LockFile(Directive):
     def __init__(self, val):
-        Directive.__init__(self, self.__class__.__name__, val)
+        import sys
+        if sys.platform!='win32':
+            Directive.__init__(self, self.__class__.__name__, val)
+        else:
+            Directive.__init__(self, '#'+self.__class__.__name__, val)
 
 class MaxClients(Directive):
     def __init__(self, val):

Modified: httpd/mod_python/trunk/test/test.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/test.py?rev=280650&r1=280649&r2=280650&view=diff
==============================================================================
--- httpd/mod_python/trunk/test/test.py (original)
+++ httpd/mod_python/trunk/test/test.py Tue Sep 13 13:35:57 2005
@@ -189,11 +189,6 @@
         # where other modules might be
         modpath = LIBEXECDIR
 
-        if sys.platform != 'win32':
-            lockfile = LockFile("logs/accept.lock")
-        else:
-            lockfile = ''
-
         s = Container(
             IfModule("prefork.c",
                      StartServers("3"),
@@ -227,7 +222,7 @@
             LogLevel("debug"),
             LogFormat(r'"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined'),
             CustomLog("logs/access_log combined"),
-            lockfile,
+            LockFile("logs/accept.lock"),
             TypesConfig("conf/mime.types"),
             PidFile("logs/httpd.pid"),
             ServerName("127.0.0.1"),