httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject Re: Need access to apr_sigwait from threaded mpm.
Date Fri, 13 Apr 2001 21:07:53 GMT
+1 on this code. It is basically right and demonstrates the proper way to sync thread
exits using pthread calls. Whadda I gotta do to convince ya doubting Thomases...

Bill

> "William A. Rowe, Jr." wrote:
> >
> > Please don't commit first.  Could you describe the API so I can ensure that
> > other non-unix threading implemenations could perform some similar strucutre?
> > I may need to introduce some unix no-ops that have an effect on win/netware.
>
> I am currently testing this, but the code looks like this:
> ... existing child_main code except that "thread" becomes "threads[]" and the
create_thread
> call stores the thread info into the threads array for later join use, then the end of
> child_main becomes...
>
>     apr_signal_thread(check_signal);
>
>     /* A terminating signal was received. Now join each of the workers to clean them
up.
*/
>     /*   If the worker already exited, then the join frees their resources and returns.
*/
>     /*   If the worker hasn't exited, then this blocks until they have (then cleans up).
*/
>     for (i = 0; i < ap_threads_per_child; i++) {
>         apr_thread_join(&rv, threads[i]);
>     }
>
>     free (threads);
>                           /* The function check_signal just returns 0/1. I doesn't call
*/
>     clean_child_exit(0);  /*   just_die now so that the above joining can happen. This
*/
> }                         /*   means that i need to call clean_child_exit here...
*/
>
> Hopefully this will work for you since it uses apr calls (unless they aren't implemented
> everywhere yet).
>
> Let me know if this is a problem.
>
> --
> Paul J. Reder
> -----------------------------------------------------------
> "The strength of the Constitution lies entirely in the determination of each
> citizen to defend it.  Only if every single citizen feels duty bound to do
> his share in this defense are the constitutional rights secure."
> -- Albert Einstein
>


Mime
View raw message