httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas, Peter" <ptho...@HPTI.com>
Subject Re: After-request hooks or asychronous modules
Date Sun, 28 Feb 2010 16:42:43 GMT
The trick with any such thing is in protecting yourself from attack.
Consider...you could fork, let the parent continue on its business, disown
the child, and do your work there. Easy in terms of lines of code, but
expensive (forks) and potentially hazardous.

You could create a thread pool to do the job, and only block the response
when you had to wait for a worker. More complex to code, but you control
how much of your resources you're willing to expend.

Samuel ROZE <samuel.roze@gmail.com> wrote:

A dedicated process or thread just for my module, or still linked to
the Apache request? The better thing is to create a thread unlinked
with the Apache request, it is possible? I'm like a Newbie with Apache
module development, is there somewhere an example or a sample of code?

Like I said, the better thing is that I create a thread (more
efficient than process I thing) which could run 10s if it want without
interfering with the initial request and with others. I thing it isn't
easy, that's why I need a few help :-)

Thanks a lot for your reply,
Samuel.

2010/2/28 Eric Covener <covener@gmail.com>:
> On Sun, Feb 28, 2010 at 5:27 AM, Samuel ROZE <samuel.roze@gmail.com>
wrote:
>> Yes, the log_transaction hook is what I expect, thanks! :-)
>>
>> But I've still a problem: if in my hook function I put a sleep
function,
>> which sleep for 10 seconds for example, the first page is served
>> correctly (few ms) but for the next, it will wait for these 10s (not
>> really 10s but the rest time), is it because I should have threads?
>
> You could start a dedicated thread or process in e.g. post_config and
> just post work to it asynchronously in log_transaction.
>
>
> --
> Eric Covener
> covener@gmail.com
>


Mime
View raw message