apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard <judicat...@gmail.com>
Subject Info about APR threads
Date Wed, 21 Dec 2005 11:09:54 GMT
Hello,

I am trying to get some more info and documentation on APR threads and APR
pools. I find the documentation pretty scarce so far.
For APR pools, the link "Using APR
Pools<http://svn.apache.org/viewcvs.cgi/apr/apr/docs/pool-design.html>"
(http://svn.apache.org/viewcvs.cgi/apr/apr/docs/pool-design.html) on the APR
apache web site is unfortunately not working.
Anyhow, I've been grepping the Apache source code to find out how to use the
APR pool and APR threads API.

In the prototype I am working on, I have multi-threaded processes sharing a
shared-memory buffer (setup through a system call similar to MMAP shared). I
have to synchronize accesses to shared data found in the shared buffer. I
can actually do this using pthreads and I was the first one to be surprised.
Your pthread mutex can reside on the shared memory buffer, one process can
call ptrhead_mutex_init() and the other process can start using and locking
on that mutex.

Now APR pools greatly complicate my situation. If I undestand correctly,
apr_thread_mutex_create() needs a pool and the actual mutex will be
allocated from that pool. The location of that pool in memory will not be
shared among my processes. So is that a limitation of APR mutexes ? APR
mutexes cannot be shared among processes ? Is there a way to get around that
? Is there a hack that could be done by using a special memory allocator for
that pool ?

I am sure that the answer is that I am using the APR library for something
that it was not designed for. Unfortunately, it is hard to get a feel of how
to use a library correctly when documentation about the library is scarce.

So maybe I should give some background on what I am working on. I am working
with Apache, mod_ssl and openssl. Apache is running with the worker MPM.
I have modified Apache so that the apache processes share a shared-memory
buffer (basically setup through a syscall similar to mmap shared). I have a
special SSL engine that takes care of cerficate signatures. Each apache
thread servicing an SSL connection queues the signature request in the
shared buffer which is processed by an outside application responsible for
encryption. So I need a way to synchronize the various threads inside each
apache process.

Thanks
Richard

Mime
View raw message