rev 173 - in trunk: include/prothon modules/String pr src

SVN User <[email protected]>
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-03-28 02:23:59 -0500 (Sun, 28 Mar 2004)
New Revision: 173

Modified:
   trunk/include/prothon/prothon_dll.h
   trunk/modules/String/String.c
   trunk/pr/file_test.pr
   trunk/src/main.c
   trunk/src/object.c
Log:
fixed file_test

Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h	2004-03-28 06:25:20 UTC (rev 172)
+++ trunk/include/prothon/prothon_dll.h	2004-03-28 07:23:59 UTC (rev 173)
@@ -112,6 +112,8 @@
 
 	void		    (*del_lock)(obj_p obj);		
 	void		  (*del_unlock)(obj_p obj);	
+	void	   (*set_unmutable)(obj_p obj);		
+	void	   (*clr_unmutable)(obj_p obj);
 
 
 } pr_services_t;
@@ -179,8 +181,9 @@
 #define write_unlock		(*services->write_unlock)	
 #define del_lock			(*services->del_lock)	
 #define del_unlock			(*services->del_unlock)	
+#define set_unmutable		(*services->set_unmutable)	
+#define clr_unmutable		(*services->clr_unmutable)	
 #define get_pr_head_pool	(*services->get_pr_head_pool)	
 
-
 #endif // OBJECT_H
 #endif // PROTHON_DLL_H

Modified: trunk/modules/String/String.c
===================================================================
--- trunk/modules/String/String.c	2004-03-28 06:25:20 UTC (rev 172)
+++ trunk/modules/String/String.c	2004-03-28 07:23:59 UTC (rev 173)
@@ -216,7 +216,7 @@
 		}
 	}
 	dest_ptr[tlen] = 0;
-	obj->unmutable = TRUE;
+	set_unmutable(obj);
 	del_unlock(str_list);
 	return obj;
 }

Modified: trunk/pr/file_test.pr
===================================================================
--- trunk/pr/file_test.pr	2004-03-28 06:25:20 UTC (rev 172)
+++ trunk/pr/file_test.pr	2004-03-28 07:23:59 UTC (rev 173)
@@ -21,7 +21,7 @@
 f.seek(7)
 x = f.read(7)
 print x
-if (x != 'line 1\n'): 
+if (x != 'line 2\n'): 
 	print "test failed: x != 'line 1'"
 	Sys.exit(1)
 

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2004-03-28 06:25:20 UTC (rev 172)
+++ trunk/src/main.c	2004-03-28 07:23:59 UTC (rev 173)
@@ -68,12 +68,14 @@
 #include <apr_thread_proc.h>
 #include <apr_portable.h>
 
+#define MEMMGR_TIMEOUT	(200/PAUSE_MS)  /* 200 ms */
+
 extern int yydebug;
 
 static apr_pool_t *apr_root_pool = NULL;
 
-apr_pool_t* get_pr_head_pool(void)
-{
+//**************************** get_pr_head_pool *******************************
+apr_pool_t* get_pr_head_pool(void) {
 	if (!apr_root_pool) {
 		printf("get_pr_head_pool error: called with no pool\n");
 		pr_exit(1);
@@ -85,6 +87,7 @@
 static clist_p thread_registry;
 static DECLARE_PR_LOCK(thread_registry_lock);
 
+//**************************** register_thread ********************************
 /* New threads must call this first thing, it will release the
  * thread_registry_lock so that other threads can start. 
  * Returns the matching thread object */
@@ -103,6 +106,7 @@
 static apr_threadattr_t *thread_attr = NULL;
 static apr_pool_t *thread_pool = NULL;
 
+//********************************* new_thread_obj ****************************
 obj_p new_thread_obj(apr_thread_start_t thread_func, void *thread_data)
 {
 	apr_status_t aprerr;
@@ -144,8 +148,8 @@
 	return new_thread_object;
 }
 
-apr_thread_t* os_thread_2_apr(apr_os_thread_t os_thread)
-{
+//********************************* os_thread_2_apr ***************************
+apr_thread_t* os_thread_2_apr(apr_os_thread_t os_thread) {
 	int i;
 	apr_thread_t *res = NULL;
 
@@ -163,13 +167,14 @@
 	return res;
 }
 
+//********************************* main **************************************
 int main(int argc, char *argv[]) {
 	obj_p sys_argv_obj, main_argv_obj, threads, code_str_obj, main1_thread_obj;
 	pr_thread_p main1_thread_ptr = NULL;
 	isp ist;
 	apr_status_t aprerr;
 	char buf[1024];
-	int cmd_line_option_i_flg;
+	int cmd_line_option_i_flg, mem_mgr_count;
 
 #ifdef DEBUG_THREADS
 	int torture_scan_num_ptr[]={1,2,3,4,5};
@@ -259,7 +264,8 @@
 #endif
 
 	mem_mgr_req_termination = TRUE;
-	while(!mem_mgr_terminated) apr_sleep(PAUSE_MS*1000);
+	mem_mgr_count = 0;
+	while(!mem_mgr_terminated && ++mem_mgr_count < MEMMGR_TIMEOUT) apr_sleep(PAUSE_MS*1000);
 
 #ifdef DEBUG_THREADS
 	printf("Memory manager terminated, now stopping torture threads ...\n");

Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c	2004-03-28 06:25:20 UTC (rev 172)
+++ trunk/src/object.c	2004-03-28 07:23:59 UTC (rev 173)
@@ -263,6 +263,8 @@
 	dll_services.write_unlock	  = write_unlock;
 	dll_services.del_lock		  = del_lock;
 	dll_services.del_unlock	      = del_unlock;
+	dll_services.set_unmutable	  = set_unmutable;
+	dll_services.clr_unmutable	  = clr_unmutable;
 	dll_services.get_pr_head_pool = get_pr_head_pool;
 
 	set_attr(ist, OBJ(OBJECT), sym(ist, "Root_Globals"), OBJ(ROOT_GLOBALS));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.