[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modules
Subject:    Re: [apache-modules] Re: Thread
From:       rm () fabula ! de
Date:       2004-01-13 19:26:23
Message-ID: 20040113192623.GI11420 () www
[Download RAW message or body]

On Tue, Jan 13, 2004 at 06:25:57PM +0100, Christian Parpart wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Tuesday 13 January 2004 6:02 pm, Marco Spinetti wrote:
> > No,
> >
> > I'm starting threads in child process (inside handler function) not
> > during reading of configuration data.
> >
> > Reading your email it seems that using pthreads inside child process in
> > apache 1.3.x gives strange results and it will not work as expected,
> > while using apache 2 all is ok.
> >
> > Is it true?
> 
> it is not (at all).

Are you talking about v1.3.x or 2.x.x???

> I believe this, because I have developed a module that had to watch for I/O 
> events on 2 sockets (web client and backend server). This was done in a 
> backgroupd thread, so that I could do usual work in the main handler process.
> Unfortunately, my error log was flooding me with thouthends of segfault 
> messages (very often requested module), and after having removed any thread 
> connection in this module, my segfaults has been reduced to a very more 
> acceptable minimum.

Sorry, without any offence, but this doesn't say anything about the possibility
of threading in Apache per se, or? I'm not a thread advocate at all and 
try to avoid them but there are a lot of place one can mess up (hmm, did you
try to 'select' on the _client_ filehandle? That's probably not a good
idea - that's where apache comes in ...).


> 
> > What is the right and real answer?
> 
> The right thing I believe, is, if you'r coding an apache module, you should 
> try to design it in a flat model, that is, without any threads.
> For listening for I/O events for example do a select/poll/epoll or even use 
> (that still not yet understood how to use easily) apr_poll API by apache.

Yes, apr_poll seems to be the 'right' way if one wants to use threads.

 HTH Ralf Mattes

> best regards,
> Christian Parpart.
> 
> - -- 
>  18:10:33 up 7 days,  5:00,  2 users,  load average: 0.29, 0.33, 0.34
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> 
> iD8DBQFABCoqPpa2GmDVhK0RAjfWAKCHxq6MaGl1LCVzfxj/QUUfjLzzqACfXdbJ
> h+rQKI+JKfTLbHPkIv5/S2M=
> =aRSI
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
> For additional commands, e-mail: apache-modules-help@covalent.net

---------------------------------------------------------------------
To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
For additional commands, e-mail: apache-modules-help@covalent.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic