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 <[email protected]> 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 <[email protected]>: > On Sun, Feb 28, 2010 at 5:27 AM, Samuel ROZE <[email protected]> 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 > [email protected] >
