httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r711897 - in /httpd/mod_wombat/trunk: README vmprep.c vmprep.h
Date Thu, 06 Nov 2008 16:31:08 GMT
Author: brianm
Date: Thu Nov  6 08:30:53 2008
New Revision: 711897

URL: http://svn.apache.org/viewvc?rev=711897&view=rev
Log:
starting work on better lifecycle management

Modified:
    httpd/mod_wombat/trunk/README
    httpd/mod_wombat/trunk/vmprep.c
    httpd/mod_wombat/trunk/vmprep.h

Modified: httpd/mod_wombat/trunk/README
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/README?rev=711897&r1=711896&r2=711897&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/README (original)
+++ httpd/mod_wombat/trunk/README Thu Nov  6 08:30:53 2008
@@ -4,7 +4,6 @@
 ** libapreq2 ( http://httpd.apache.org/apreq/download.cgi )
 ** Apache HTTPD 2.2 ( http://httpd.apache.org/ )
 
-
 * Documentation
   See docs/README
 
@@ -27,7 +26,8 @@
   Could use apr_thread_data_(get|set) if I can find a way to hook into
   thread destruction. Looks like apr threads let you use the standard
   APR_POOL_DECLARE_ACCESSOR(thread); defined method, just need to look
-  up what form that takes. 
+  up what form that takes. -- apr_thread_pool_get -- just attach to
+  that pool.
 
   Given that, we can associate a hash of lua_State instances with
   arbitrary pools, such as the request pool, thread pool, server pool,
@@ -35,7 +35,7 @@
   specify the handler function, can then make use of the same file
   with different handlers to reuse states.
 
-  Review Blue PiL 265-267 for cleaning up UserData stuff.
+  
 
 * Task List
 ** TODO Use r->file to determine file, doing rewriting in translate_name   

Modified: httpd/mod_wombat/trunk/vmprep.c
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/vmprep.c?rev=711897&r1=711896&r2=711897&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/vmprep.c (original)
+++ httpd/mod_wombat/trunk/vmprep.c Thu Nov  6 08:30:53 2008
@@ -655,6 +655,26 @@
     return lua_pcall(L, 0, LUA_MULTRET, 0);
 }
 
+lua_State* apw_get_lua_state(apr_pool_t* lifecycle_pool, char* file) {
+    
+    lua_State* L;
+    if (!apr_pool_userdata_get((void**)&L, file, lifecycle_pool)) {
+        // not available, so create
+        L =  luaL_newstate();
+        luaL_openlibs(L);
+        apw_run_wombat_open(L, lifecycle_pool);
+        
+        // munge_path(L, "path", "?.lua", "./?.lua", pool, spec->package_paths, spec->file);
+        // munge_path(L, "cpath", "?.so", "./?.so", pool, spec->package_cpaths, spec->file);
+        luaL_loadfile(L, file);
+        lua_pcall(L, 0, LUA_MULTRET, 0);
+        apr_pool_userdata_set(L, file, &cleanup_lua, lifecycle_pool);
+        
+        lua_pushlightuserdata(L, lifecycle_pool);
+        lua_setfield(L, LUA_REGISTRYINDEX, "Apache2.Wombat.pool");
+    }
+    return L;
+}
 
 
 

Modified: httpd/mod_wombat/trunk/vmprep.h
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/vmprep.h?rev=711897&r1=711896&r2=711897&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/vmprep.h (original)
+++ httpd/mod_wombat/trunk/vmprep.h Thu Nov  6 08:30:53 2008
@@ -103,5 +103,8 @@
 // returns NULL if the spec requires a request scope or conn scope
 lua_State* apw_sgetvm(server_rec *r, apw_vm_spec *spec);
 
+// alternate means of getting lua_State
+lua_State* apw_get_lua_state(apr_pool_t* lifecycle_pool, char* file);
+
 #endif
 



Mime
View raw message