cvs: TSRM(PHP_5_1) / TSRM.c TSRM.h php-src NEWS php-src/main main.c

From: Date: Tue, 14 Mar 2006 15:16:07 +0000
Subject: cvs: TSRM(PHP_5_1) / TSRM.c TSRM.h php-src NEWS php-src/main main.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to [email protected] to get a copy of this message
dmitry		Tue Mar 14 15:16:07 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src	NEWS 
    /php-src/main	main.c 
    /TSRM	TSRM.c TSRM.h 
  Log:
  Fixed bug #35988 (Unknown persistent list entry type in module shutdown)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.460&r2=1.2027.2.461&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.460 php-src/NEWS:1.2027.2.461
--- php-src/NEWS:1.2027.2.460	Tue Mar 14 14:55:13 2006
+++ php-src/NEWS	Tue Mar 14 15:16:07 2006
@@ -9,6 +9,8 @@
 - Fixed bug #36697 (Transparency is lost when using imagecreatetruecolor).
  (Pierre)
 - Fixed bug #36568 (memory_limit setting on win32 has no effect). (Dmitry)
+- Fixed bug #35988 (Unknown persistent list entry type in module shutdown).
+  (Dmitry)
 
 09 Mar 2006, PHP 5.1.3RC1
 - Updated PCRE to version 6.6. (Andrei)
http://cvs.php.net/viewcvs.cgi/php-src/main/main.c?r1=1.640.2.19&r2=1.640.2.20&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.19 php-src/main/main.c:1.640.2.20
--- php-src/main/main.c:1.640.2.19	Mon Mar 13 09:35:45 2006
+++ php-src/main/main.c	Tue Mar 14 15:16:07 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.640.2.19 2006/03/13 09:35:45 dmitry Exp $ */
+/* $Id: main.c,v 1.640.2.20 2006/03/14 15:16:07 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -1594,6 +1594,10 @@
 		return;
 	}
 
+#ifdef ZTS
+	ts_free_worker_threads();
+#endif
+
 #if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
 	/*close winsock */
 	WSACleanup();
http://cvs.php.net/viewcvs.cgi/TSRM/TSRM.c?r1=1.68.2.2&r2=1.68.2.3&diff_format=u
Index: TSRM/TSRM.c
diff -u TSRM/TSRM.c:1.68.2.2 TSRM/TSRM.c:1.68.2.3
--- TSRM/TSRM.c:1.68.2.2	Wed Jan  4 23:55:42 2006
+++ TSRM/TSRM.c	Tue Mar 14 15:16:07 2006
@@ -480,6 +480,52 @@
 }
 
 
+/* frees all resources allocated for all threads except current */
+void ts_free_worker_threads(void)
+{
+	tsrm_tls_entry *thread_resources;
+	int i;
+	THREAD_T thread_id = tsrm_thread_id();
+	int hash_value;
+	tsrm_tls_entry *last=NULL;
+
+	tsrm_mutex_lock(tsmm_mutex);
+	hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
+	thread_resources = tsrm_tls_table[hash_value];
+
+	while (thread_resources) {
+		if (thread_resources->thread_id != thread_id) {
+			for (i=0; i<thread_resources->count; i++) {
+				if (resource_types_table[i].dtor) {
+					resource_types_table[i].dtor(thread_resources->storage[i],
&thread_resources->storage);
+				}
+			}
+			for (i=0; i<thread_resources->count; i++) {
+				free(thread_resources->storage[i]);
+			}
+			free(thread_resources->storage);
+			if (last) {
+				last->next = thread_resources->next;
+			} else {
+				tsrm_tls_table[hash_value] = thread_resources->next;
+			}
+			free(thread_resources);
+			if (last) {
+				thread_resources = last->next;
+			} else {
+				thread_resources = tsrm_tls_table[hash_value];
+			}
+		} else {
+			if (thread_resources->next) {
+				last = thread_resources;
+			}
+			thread_resources = thread_resources->next;
+		}
+	}
+	tsrm_mutex_unlock(tsmm_mutex);
+}
+
+
 /* deallocates all occurrences of a given id */
 void ts_free_id(ts_rsrc_id id)
 {
http://cvs.php.net/viewcvs.cgi/TSRM/TSRM.h?r1=1.50.2.1&r2=1.50.2.2&diff_format=u
Index: TSRM/TSRM.h
diff -u TSRM/TSRM.h:1.50.2.1 TSRM/TSRM.h:1.50.2.2
--- TSRM/TSRM.h:1.50.2.1	Wed Jan  4 23:55:42 2006
+++ TSRM/TSRM.h	Tue Mar 14 15:16:07 2006
@@ -106,6 +106,9 @@
 /* frees all resources allocated for the current thread */
 TSRM_API void ts_free_thread(void);
 
+/* frees all resources allocated for all threads except current */
+void ts_free_worker_threads(void);
+
 /* deallocates all occurrences of a given id */
 TSRM_API void ts_free_id(ts_rsrc_id id);
 


Thread (1 message)

  • Dmitry Stogov
« previous php.zend-engine.cvs (#4726) next »