You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Aaron Bannert <aa...@ebuilt.com> on 2001/07/24 17:07:29 UTC

Re: cvs commit: apr/threadproc/beos thread.c

Ah, good catch. My bad.

It basicly comes down to: How to get access to the child-pool from within
the thread worker_fn(). As long as we have APR creating the child-pool
from within the thread creation routines, it's gotta provide access to
that child-pool somewhere.

OS2 was already doing this to an extent.

-aaron


On Tue, Jul 24, 2001 at 10:53:06AM -0000, dreid@apache.org wrote:
> dreid       01/07/24 03:53:06
> 
>   Modified:    threadproc/beos thread.c
>   Log:
>   dummy_func != dummy_worker
>   
>   I'm sorry, but this change seems crazy to me.  Know I haven't been following
>   the discussion that closely - how many patches???? - but this doesn't feel
>   right.  Adding more indirections to gain what exactly?
>   
>   Revision  Changes    Path
>   1.24      +7 -7      apr/threadproc/beos/thread.c
>   
>   Index: thread.c
>   ===================================================================
>   RCS file: /home/cvs/apr/threadproc/beos/thread.c,v
>   retrieving revision 1.23
>   retrieving revision 1.24
>   diff -u -r1.23 -r1.24
>   --- thread.c	2001/07/24 05:16:32	1.23
>   +++ thread.c	2001/07/24 10:53:06	1.24
>   @@ -88,25 +88,25 @@
>    	return APR_NOTDETACH;
>    }
>    
>   -void *dummy_worker(void *opaque)
>   +static void *dummy_worker(void *opaque)
>    {
>        apr_thread_t *thd = (apr_thread_t*)opaque;
>        return thd->func(thd, thd->data);
>    }
>    
>    apr_status_t apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr,
>   -                             apr_thread_start_t func, void *data,
>   -                             apr_pool_t *cont)
>   +                               apr_thread_start_t func, void *data,
>   +                               apr_pool_t *pool)
>    {
>        int32 temp;
>        apr_status_t stat;
>        
>   -    (*new) = (apr_thread_t *)apr_palloc(cont, sizeof(apr_thread_t));
>   +    (*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
>        if ((*new) == NULL) {
>            return APR_ENOMEM;
>        }
>    
>   -    (*new)->cntxt = cont;
>   +    (*new)->cntxt = pool;
>        (*new)->data = data;
>        (*new)->func = func;
>    
>   @@ -116,12 +116,12 @@
>    	else
>    	    temp = B_NORMAL_PRIORITY;
>    
>   -    stat = apr_pool_create(&(*new)->cntxt, cont);
>   +    stat = apr_pool_create(&(*new)->cntxt, pool);
>        if (stat != APR_SUCCESS) {
>            return stat;
>        }
>    
>   -    (*new)->td = spawn_thread((thread_func)dummy_func, "apr thread", temp, (*new));
>   +    (*new)->td = spawn_thread((thread_func)dummy_worker, "apr thread", temp, (*new));
>        /* Now we try to run it...*/
>        if (resume_thread((*new)->td) == B_NO_ERROR) {
>            return APR_SUCCESS;
>   
>   
>