Commit:    d70ed26aaac1d3f613026f61d115a0ce05190315
Author:    Dmitry Stogov <dmi...@zend.com>         Fri, 15 Feb 2013 15:08:51 
+0400
Parents:   bde294f8ebaf95bba51c4951f02cf0acc08b3184
Branches:  PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=d70ed26aaac1d3f613026f61d115a0ce05190315

Log:
Added ZTS lock

Changed paths:
  M  zend_shared_alloc.c


Diff:
diff --git a/zend_shared_alloc.c b/zend_shared_alloc.c
index 3b93d04..12bfef2 100644
--- a/zend_shared_alloc.c
+++ b/zend_shared_alloc.c
@@ -53,6 +53,9 @@ static const char *g_shared_model;
 zend_smm_shared_globals *smm_shared_globals;
 
 #ifndef ZEND_WIN32
+#ifdef ZTS
+static MUTEX_T zts_lock;
+#endif
 int lock_file;
 static char lockfile_name[sizeof(TMP_DIR)+sizeof(SEM_FILENAME_PREFIX)+8];
 #endif
@@ -78,6 +81,10 @@ void zend_shared_alloc_create_lock(void)
 {
        int val;
 
+#ifdef ZTS
+    zts_lock = tsrm_mutex_alloc();
+#endif
+
        sprintf(lockfile_name, "%s/%sXXXXXX", TMP_DIR, SEM_FILENAME_PREFIX);
        lock_file = mkstemp(lockfile_name);
        fchmod(lock_file, 0666);
@@ -341,6 +348,11 @@ static FLOCK_STRUCTURE(mem_write_unlock, F_UNLCK, 
SEEK_SET, 0, 1);
 void zend_shared_alloc_lock(TSRMLS_D)
 {
 #ifndef ZEND_WIN32
+
+#ifdef ZTS
+       tsrm_mutex_lock(zts_lock);
+#endif
+
 #if 0
        /* this will happen once per process, and will un-globalize 
mem_write_lock */
        if (mem_write_lock.l_pid == -1) {
@@ -383,6 +395,9 @@ void zend_shared_alloc_unlock(TSRMLS_D)
        if (fcntl(lock_file, F_SETLK, &mem_write_unlock) == -1) {
                zend_accel_error(ACCEL_LOG_ERROR, "Cannot remove lock - %s 
(%d)", strerror(errno), errno);
        }
+#ifdef ZTS
+       tsrm_mutex_unlock(zts_lock);
+#endif
 #else
        zend_shared_alloc_unlock_win32();
 #endif


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to