rev 634 - in trunk: pr/test src
SVN User <[email protected]> Fri, 18 Jun 2004 02:05:28 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-06-18 02:05:25 -0400 (Fri, 18 Jun 2004)
New Revision: 634
Modified:
trunk/pr/test/test.pr
trunk/src/builtins-file.c
trunk/src/builtins-thread.c
trunk/src/main.c
trunk/src/memory_mgr.c
Log:
mem mgr now calls del_ on all objects without deleting any objects on shutdown. TempDir is now deleted on shutdown.
Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr 2004-06-18 02:18:41 UTC (rev 633)
+++ trunk/pr/test/test.pr 2004-06-18 06:05:25 UTC (rev 634)
@@ -1,7 +1,7 @@
#!/usr/bin/env prothon
print TempDir
-// print TempDir(), TempDir
+print TempDir(), TempDir
/*
d = Dir()
Modified: trunk/src/builtins-file.c
===================================================================
--- trunk/src/builtins-file.c 2004-06-18 02:18:41 UTC (rev 633)
+++ trunk/src/builtins-file.c 2004-06-18 06:05:25 UTC (rev 634)
@@ -588,6 +588,12 @@
return OBJ(NONE);
}
+DEF(TempDir, del_, NULL) {
+ BIN_CONTENT_CHK(TempDir);
+ call_func0(ist, self, sym(ist, "delete"));
+ return OBJ(NONE);
+}
+
DEF(TempDir, str_, NULL) {
char buf[300], *path;
BIN_STR_CHK(TempDir);
@@ -1721,6 +1727,7 @@
MODULE_SUB_INIT(TempDir);
MODULE_ADD_SYM(TempDir, init_);
MODULE_ADD_SYM(TempDir, str_);
+ MODULE_ADD_SYM(TempDir, del_);
MODULE_SUB_INIT(File);
MODULE_ADD_SYM(File, init_);
Modified: trunk/src/builtins-thread.c
===================================================================
--- trunk/src/builtins-thread.c 2004-06-18 02:18:41 UTC (rev 633)
+++ trunk/src/builtins-thread.c 2004-06-18 06:05:25 UTC (rev 634)
@@ -333,7 +333,6 @@
MODULE_SET_DOC(Mutex, "mutex object prototype");
set_attr(ist, OBJ(OBJECT), sym(ist, "Mutex"), Mutex_OBJ);
- SET_TYPE_IF_EXC(Mutex_OBJ, Mutex_OBJ, DATA_TYPE_DATAPTR) return;
Mutex_OBJ->unclonable = TRUE;
}
@@ -345,7 +344,8 @@
aprerr = apr_pool_create(&subpool, get_pr_head_pool());
IF_APR_ERR("out of memory creating mutex") return NULL;
SET_TYPE_IF_EXC(Mutex_OBJ, self, DATA_TYPE_DATAPTR) return NULL;
- aprerr = apr_thread_mutex_create((apr_thread_mutex_t**)(&self->data.ptr), APR_THREAD_MUTEX_UNNESTED, subpool);
+ aprerr = apr_thread_mutex_create( (apr_thread_mutex_t**)(&self->data.ptr),
+ APR_THREAD_MUTEX_UNNESTED, subpool );
IF_APR_ERR("error creating mutex in apr_thread_mutex_create") return NULL;
self->unclonable = TRUE;
return OBJ(NONE);
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2004-06-18 02:18:41 UTC (rev 633)
+++ trunk/src/main.c 2004-06-18 06:05:25 UTC (rev 634)
@@ -70,7 +70,7 @@
#include <apr_thread_proc.h>
#include <apr_portable.h>
-#define MEMMGR_TIMEOUT (2000000/PAUSE_MS) /* 200 ms */
+#define MEMMGR_TIMEOUT (10000/PAUSE_MS) /* 200 ms */
#ifdef TRACE_PARSER
extern int yydebug;
Modified: trunk/src/memory_mgr.c
===================================================================
--- trunk/src/memory_mgr.c 2004-06-18 02:18:41 UTC (rev 633)
+++ trunk/src/memory_mgr.c 2004-06-18 06:05:25 UTC (rev 634)
@@ -307,32 +307,26 @@
int obj_count = 0, obj_del_count = 0;
#ifdef DEBUG_MEM_MGR
time = clock();
- printf("Memory manager phase: Deleting all remaining objects\n");
+ printf("Memory manager phase: Calling del_ on all remaining objects\n");
#endif
mem_mgr_phase = MM_PHASE_DELETING;
pr_lock(&object_list_lock);
obj=obj_list_root;
pr_unlock(&object_list_lock);
- while(obj != core_object_marker) {
+ while(obj) {
obj_count++;
- clr_all_locks(obj);
call_func(ist, obj, SYM(DEL_), 0, NULL, NULL);
ist->exception_obj = 0;
- mm_write_lock(ist, obj);
- ist->exception_obj = 0;
- obj->state = OBJ_STATE_DELETED;
- obj_del_count++;
- free_object(obj);
pr_lock(&object_list_lock);
obj = obj->next_obj;
pr_unlock(&object_list_lock);
}
#ifdef DEBUG_MEM_MGR
- printf("Memory manager: Deleted %d of %d objects, elapsed time(secs): %g\n",
- obj_del_count, obj_count, ((clock()-time)*1.0)/CLOCKS_PER_SEC );
+ printf("Memory manager: Called del_ on %d objects, elapsed time(secs): %g\n",
+ obj_count, ((clock()-time)*1.0)/CLOCKS_PER_SEC );
#endif
#ifdef DEBUG_THREADS
- if (debug_threads) printf("Memory manager thread terminating\n");
+ if (debug_threads) printf("Memory manager thread terminating\n");
#endif
mem_mgr_error = MMERR_NORMAL_TERMINATION;
mem_mgr_running = FALSE;