On Wed, 25 Sep 2002, Charles Reitzel wrote: > Hi All, > > This is a thorny (to me) module development question. I have asked on the > module list and searched the archives, but have found only a partial > answer. Any pointers will be appreciated. > > Objective: to create a mutex-free pool per worker in non-MPM-specific way. > > I found this exchange in a June posting: > > > Another change we made, as I mentioned in a previous > > > Email, was using non-mutexing per-thread memory > > > pools (HeapCreate(HEAP_NO_SERIALIZE, ...)). > To get > > > best performance with Apache 2 we would really need > > > such a memory pool. > > > >And we already have it! Just do: > > > > apr_allocator_t *allocator; > > apr_allocator_create(&allocator); > > apr_pool_create_ex(&pool, parent_pool, abort_fn, allocator); > > apr_allocator_owner_set(allocator, pool); > > > >Now you have a mutexless allocator associated with a pool. All child pools > >of this pool will use the same allocator and will therefor also have no mutex. > > Looks good. But I have questions. What is the correct place to put this > code and where do keep the pool pointer afterwards. I.e. how do you find > the pool from within a module handler? > > <comment> > To my mind, the Apache module API is missing an important data structure: > worker_rec. It is obviously redundant (but does no harm) in the prefork > MPM, but is a necessary ingredient in _any_ threaded MPM. Such a structure > would allow modules to be written as thread-safe - independent of the MPM > currently configured by the user. The request record could and should > contain a pointer to the current worker for easy access. In the absence of > a worker_rec, however, some guidance on the above would be helpful. > </comment>
The structures in Apache are designed around an HTTP request, not the entity that is running the request. Every threaded MPM has a pool for each thread, which does allow for thread-safe programming. Why exactly would you want a worker_rec? What problem are you having? Ryan _______________________________________________________________________________ Ryan Bloom [EMAIL PROTECTED] 550 Jean St Oakland CA 94610 -------------------------------------------------------------------------------