* If you pass the same pointer to all callbacks them how do I choose which the 
pipe to use? or are you assuming all worker threads write back to the same pipe 
(doesn't work without sync/mutex)?

 main thread ----- pipe1 ----- worker thr1
    |
    |------ pipe2 --- worker thr2

* My init_logging (opens the logging file) must be called in thread entry 
point, not in the callback

Thanks!
R
________________________________________
From: Sergey Lyubka [mailto:[EMAIL PROTECTED] 
Sent: quarta-feira, 28 de Maio de 2008 16:15
To: Rui Jorge Coelho
Cc: shttpd-general
Subject: Re: [shttpd-general] Accept callback: threads and pipes

I plan to do the following:
I will remove the connection list from shttpd_ctx structure.
New structure, "struct worker", will be created, that gonna hold connections.
All workers will reference the same shttpd_ctx - the "boss".


On Wed, May 28, 2008 at 2:57 PM, Rui Jorge Coelho <[EMAIL PROTECTED]> wrote:
* Yes, I didn't explain correctly ... it's the callback that sends back
data using pipe. I'm already sending private data in
shttpd_register_uri, which includes that pipe. But if it is shttpd that
spawns worker threads were do this ?
The same pointer will be passed to all callbacks

 

* I need to call my init_logging function on each of shttpd's worker
threads (to have nice enter/exit traces). Again if it is shttpd that
spaws workers were do I do this ?
You may do logging from the callback, and output thread id, which can give you 
an indication which thread is doing that.
 

* What happens if configuration changes (doc_root change for example)?
Do you plan to call set_option for each worker thread or kill/launch new
worker threads?
 
All workers share same config. I do not provision any locking during 
configuration change, though :-)
 

* Who calls shttpd_fini (to cleanup) for each worker thread? Related ...
how do you intend to end/kill the worker threads ?

I was thinking this way: shttpd_set_option("threads", "1")
It might kill all reduntant threads immediately - quick and nasty way, 
Or it may set a special "draining" flag - nice way. Draining workers won't be 
passed new sockets, and when they process last connection, they exit
 

* Shttpd forces posix threads, a good choice but I use apache portable
runtime apr_thread_create instead. For me shttpd should be about http,
not threads.

Not sure what this point means, really.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
shttpd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shttpd-general

Reply via email to