You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rüdiger Plüm <ru...@vodafone.com> on 2012/08/06 09:23:16 UTC

Fwd: svn commit: r1369656 - in /httpd/httpd/trunk/modules/lua: lua_vmprep.c lua_vmprep.h mod_lua.c mod_lua.h


-------- Original Message --------
Subject: 	svn commit: r1369656 - in /httpd/httpd/trunk/modules/lua: lua_vmprep.c lua_vmprep.h mod_lua.c mod_lua.h
Date: 	Sun, 05 Aug 2012 19:57:45 GMT
From: 	humbedooh@apache.org



Author: humbedooh
Date: Sun Aug  5 19:57:44 2012
New Revision: 1369656

URL: http://svn.apache.org/viewvc?rev=1369656&view=rev
Log:
Add a server scope for Lua states (in LuaScope), which creates a pool of  states with manageable
minimum and maximum size.

Modified:
      httpd/httpd/trunk/modules/lua/lua_vmprep.c
      httpd/httpd/trunk/modules/lua/lua_vmprep.h
      httpd/httpd/trunk/modules/lua/mod_lua.c
      httpd/httpd/trunk/modules/lua/mod_lua.h

Modified: httpd/httpd/trunk/modules/lua/lua_vmprep.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_vmprep.c?rev=1369656&r1=1369655&r2=1369656&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Sun Aug  5 19:57:44 2012
@@ -23,6 +23,15 @@

   APLOG_USE_MODULE(lua);

+#if APR_HAS_THREADS
+    apr_thread_mutex_t *ap_lua_mutex;
+
+void ap_lua_init_mutex(apr_pool_t *pool, server_rec *s)
+{
+    apr_thread_mutex_create(&ap_lua_mutex, APR_THREAD_MUTEX_DEFAULT, pool);
+}
+#endif
+

Shouldn't you use the httpd mutex API here to keep the mutex type configureable in a generic way?
See util_mutex.c / ap_mutex_register.

Regards

Rüdiger



Re: Fwd: svn commit: r1369656 - in /httpd/httpd/trunk/modules/lua: lua_vmprep.c lua_vmprep.h mod_lua.c mod_lua.h

Posted by Daniel Gruno <ru...@cord.dk>.
On 08/06/2012 11:46 AM, Plüm, Rüdiger, Vodafone Group wrote:
> 
> 
>> -----Original Message-----
>> From: Daniel Gruno [mailto:rumble@cord.dk]
>> Sent: Montag, 6. August 2012 11:31
>> To: dev@httpd.apache.org
>> Subject: Re: Fwd: svn commit: r1369656 - in
>> /httpd/httpd/trunk/modules/lua: lua_vmprep.c lua_vmprep.h mod_lua.c
>> mod_lua.h
>>
>> On 08/06/2012 09:23 AM, Rüdiger Plüm wrote:
>>>
>>>
>>> -------- Original Message --------
>>> Subject:     svn commit: r1369656 - in /httpd/httpd/trunk/modules/lua:
>>> lua_vmprep.c lua_vmprep.h mod_lua.c mod_lua.h
>>> Date:     Sun, 05 Aug 2012 19:57:45 GMT
>>> From:     humbedooh@apache.org
>>>
>>>
>>> --- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
>>> +++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Sun Aug  5 19:57:44
>> 2012
>>> @@ -23,6 +23,15 @@
>>>
>>>   APLOG_USE_MODULE(lua);
>>>
>>> +#if APR_HAS_THREADS
>>> +    apr_thread_mutex_t *ap_lua_mutex;
>>> +
>>> +void ap_lua_init_mutex(apr_pool_t *pool, server_rec *s)
>>> +{
>>> +    apr_thread_mutex_create(&ap_lua_mutex, APR_THREAD_MUTEX_DEFAULT,
>>> pool);
>>> +}
>>> +#endif
>>> +
>>>
>>> Shouldn't you use the httpd mutex API here to keep the mutex type
>>> configureable in a generic way?
>>> See util_mutex.c / ap_mutex_register.
>>>
>>> Regards
>>>
>>> Rüdiger
>>>
>>>
>> Hi Rüdiger,
>> When I looked into how httpd works with mutexes, I looked at mod_dbd for
>> inspiration, and it used the apr_thread_mutex stuff for its handling of
>> the process pools, so that's what I used. Shame on me :)
>>
>> I have changed it to use the ap_mutex functions/structs now, so all
>> should be well (unless I managed to mess that up too ;) ).
>>
>> With regards and thanks as usual for your reviews,
> 
> Sorry for pointing you in the wrong direction. The httpd mutex API is only for
> proc mutexes not for thread mutexes like you used initially (I assume you only wanted to
> coordinate multiple threads within one process and not multiple child processes).
> I did not notice this initially. So you can just revert your last commit.
> Sorry for the inconvenience.
> 
> Regards
> 
> Rüdiger
> 
Oh well, gives me something to do today ;)

With regards,
Daniel.

RE: Fwd: svn commit: r1369656 - in /httpd/httpd/trunk/modules/lua: lua_vmprep.c lua_vmprep.h mod_lua.c mod_lua.h

Posted by Plüm, Rüdiger, Vodafone Group <ru...@vodafone.com>.

> -----Original Message-----
> From: Daniel Gruno [mailto:rumble@cord.dk]
> Sent: Montag, 6. August 2012 11:31
> To: dev@httpd.apache.org
> Subject: Re: Fwd: svn commit: r1369656 - in
> /httpd/httpd/trunk/modules/lua: lua_vmprep.c lua_vmprep.h mod_lua.c
> mod_lua.h
> 
> On 08/06/2012 09:23 AM, Rüdiger Plüm wrote:
> >
> >
> > -------- Original Message --------
> > Subject:     svn commit: r1369656 - in /httpd/httpd/trunk/modules/lua:
> > lua_vmprep.c lua_vmprep.h mod_lua.c mod_lua.h
> > Date:     Sun, 05 Aug 2012 19:57:45 GMT
> > From:     humbedooh@apache.org
> >
> >
> > --- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
> > +++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Sun Aug  5 19:57:44
> 2012
> > @@ -23,6 +23,15 @@
> >
> >   APLOG_USE_MODULE(lua);
> >
> > +#if APR_HAS_THREADS
> > +    apr_thread_mutex_t *ap_lua_mutex;
> > +
> > +void ap_lua_init_mutex(apr_pool_t *pool, server_rec *s)
> > +{
> > +    apr_thread_mutex_create(&ap_lua_mutex, APR_THREAD_MUTEX_DEFAULT,
> > pool);
> > +}
> > +#endif
> > +
> >
> > Shouldn't you use the httpd mutex API here to keep the mutex type
> > configureable in a generic way?
> > See util_mutex.c / ap_mutex_register.
> >
> > Regards
> >
> > Rüdiger
> >
> >
> Hi Rüdiger,
> When I looked into how httpd works with mutexes, I looked at mod_dbd for
> inspiration, and it used the apr_thread_mutex stuff for its handling of
> the process pools, so that's what I used. Shame on me :)
> 
> I have changed it to use the ap_mutex functions/structs now, so all
> should be well (unless I managed to mess that up too ;) ).
> 
> With regards and thanks as usual for your reviews,

Sorry for pointing you in the wrong direction. The httpd mutex API is only for
proc mutexes not for thread mutexes like you used initially (I assume you only wanted to
coordinate multiple threads within one process and not multiple child processes).
I did not notice this initially. So you can just revert your last commit.
Sorry for the inconvenience.

Regards

Rüdiger

Re: Fwd: svn commit: r1369656 - in /httpd/httpd/trunk/modules/lua: lua_vmprep.c lua_vmprep.h mod_lua.c mod_lua.h

Posted by Daniel Gruno <ru...@cord.dk>.
On 08/06/2012 09:23 AM, Rüdiger Plüm wrote:
> 
> 
> -------- Original Message --------
> Subject:     svn commit: r1369656 - in /httpd/httpd/trunk/modules/lua:
> lua_vmprep.c lua_vmprep.h mod_lua.c mod_lua.h
> Date:     Sun, 05 Aug 2012 19:57:45 GMT
> From:     humbedooh@apache.org
> 
> 
> 
> Author: humbedooh
> Date: Sun Aug  5 19:57:44 2012
> New Revision: 1369656
> 
> URL: http://svn.apache.org/viewvc?rev=1369656&view=rev
> Log:
> Add a server scope for Lua states (in LuaScope), which creates a pool
> of  states with manageable
> minimum and maximum size.
> 
> Modified:
>      httpd/httpd/trunk/modules/lua/lua_vmprep.c
>      httpd/httpd/trunk/modules/lua/lua_vmprep.h
>      httpd/httpd/trunk/modules/lua/mod_lua.c
>      httpd/httpd/trunk/modules/lua/mod_lua.h
> 
> Modified: httpd/httpd/trunk/modules/lua/lua_vmprep.c
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_vmprep.c?rev=1369656&r1=1369655&r2=1369656&view=diff
> 
> ==============================================================================
> 
> --- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
> +++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Sun Aug  5 19:57:44 2012
> @@ -23,6 +23,15 @@
> 
>   APLOG_USE_MODULE(lua);
> 
> +#if APR_HAS_THREADS
> +    apr_thread_mutex_t *ap_lua_mutex;
> +
> +void ap_lua_init_mutex(apr_pool_t *pool, server_rec *s)
> +{
> +    apr_thread_mutex_create(&ap_lua_mutex, APR_THREAD_MUTEX_DEFAULT,
> pool);
> +}
> +#endif
> +
> 
> Shouldn't you use the httpd mutex API here to keep the mutex type
> configureable in a generic way?
> See util_mutex.c / ap_mutex_register.
> 
> Regards
> 
> Rüdiger
> 
> 
Hi Rüdiger,
When I looked into how httpd works with mutexes, I looked at mod_dbd for
inspiration, and it used the apr_thread_mutex stuff for its handling of
the process pools, so that's what I used. Shame on me :)

I have changed it to use the ap_mutex functions/structs now, so all
should be well (unless I managed to mess that up too ;) ).

With regards and thanks as usual for your reviews,
Daniel.