rev 633 - trunk/src

SVN User <[email protected]> Thu, 17 Jun 2004 22:18:44 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-06-17 22:18:41 -0400 (Thu, 17 Jun 2004)
New Revision: 633

Modified:
   trunk/src/main.c
   trunk/src/memory_mgr.c
   trunk/src/object.c
   trunk/src/object.h
Log:
mem mgr now calls del_ on all non-core objects during shutdown in reverse order of creation

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2004-06-17 22:34:20 UTC (rev 632)
+++ trunk/src/main.c	2004-06-18 02:18:41 UTC (rev 633)
@@ -70,7 +70,7 @@
 #include <apr_thread_proc.h>
 #include <apr_portable.h>
 
-#define MEMMGR_TIMEOUT	(200/PAUSE_MS)  /* 200 ms */
+#define MEMMGR_TIMEOUT	(2000000/PAUSE_MS)  /* 200 ms */
 
 #ifdef TRACE_PARSER
 extern int yydebug;

Modified: trunk/src/memory_mgr.c
===================================================================
--- trunk/src/memory_mgr.c	2004-06-17 22:34:20 UTC (rev 632)
+++ trunk/src/memory_mgr.c	2004-06-18 02:18:41 UTC (rev 633)
@@ -80,7 +80,14 @@
 i64_t hi_mem_boundary;
 i64_t lo_mem_boundary;
 
-//********************************* mm_write_lock ********************************
+//********************************* clr_all_locks *****************************
+void clr_all_locks(obj_p obj) {
+	apr_atomic_set(&(obj->wrlock), 0);	
+	obj->rdlock_cnt = 0;				
+	obj->wrlock_req_cnt = 0;			
+}
+
+//********************************* mm_write_lock *****************************
 void mm_write_lock(isp ist, obj_p obj) {
 	get_wrlock(obj, NO_WAIT);
 	if(obj->rdlock_cnt) {
@@ -306,8 +313,9 @@
 		pr_lock(&object_list_lock); 
 		obj=obj_list_root;
 		pr_unlock(&object_list_lock); 
-		while(obj) {
+		while(obj != core_object_marker) {
 			obj_count++;
+			clr_all_locks(obj);
 			call_func(ist, obj, SYM(DEL_), 0, NULL, NULL);
 			ist->exception_obj = 0;
 			mm_write_lock(ist, obj);

Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c	2004-06-17 22:34:20 UTC (rev 632)
+++ trunk/src/object.c	2004-06-18 02:18:41 UTC (rev 633)
@@ -98,6 +98,7 @@
 #endif
 
 obj_p OBJ[OBJ_ENUM_COUNT];
+obj_p core_object_marker;
 
 //********************************* object_store_init ***************************
 void object_store_init(isp ist, int nop2){
@@ -246,6 +247,11 @@
 
 	/* Now load the actual modules for the builtin prototypes */
 	BUILTIN_LOAD(Core);
+
+	pr_lock(&object_list_lock);
+	core_object_marker = obj_list_root;
+	pr_unlock(&object_list_lock);
+
 	BUILTIN_LOAD(Dict);
 	BUILTIN_LOAD(AttrDict);
 	BUILTIN_LOAD(Bytes);

Modified: trunk/src/object.h
===================================================================
--- trunk/src/object.h	2004-06-17 22:34:20 UTC (rev 632)
+++ trunk/src/object.h	2004-06-18 02:18:41 UTC (rev 633)
@@ -77,6 +77,7 @@
 void console(isp ist);
 
 extern obj_p		obj_list_root;
+extern obj_p        core_object_marker;
 extern pr_lock_t	object_list_lock;
 
 // #define NDEBUG