httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Holsman <i...@apache.org>
Subject Re: How can I use a data structure shared by all the httpd process ?
Date Wed, 21 Aug 2002 15:06:41 GMT
Sébastien Bonnegent wrote:
> Hi,
> 
> My purpose is sharing a data structure.
> For example with an array:
> - httpd creation, my_array is empty
> - there are 8 servers launched
> - server1 add an entry named (X)
> - server5 add an entry
> - server3 read an entry
> - server7 remove the (X) entry
> After this, my_array contains one line which is the server5 entry.
> 
you will need to create a shared memory area to put your structure in,
and have some kind of locking mechanism to ensure you don't have any
race conditions.

have a look at apr-utils/misc/apr_rmm.c & apr_queue.c for an idea on
what it required.
> For the moment, I use a "apr_array_header_t * my_array" and I put
> it in httpd.h.
> 
> My problem is :
> 	each server process access to a copy of the array, so they
> 	could not share data..
> 	Example:
> 		server1 array contains 0 element
> 		server2 array contains 3 elements
> 		server3 ....
> 
> But, I want :
> 	an unique array
> 	Example:
> 		server1 ----\
> 		server2	-----\	
> 		server3 ------\
> 		server4 ----------> contains X elements
> 		...
> 
> Please, could someone give me a solution ?
> 
> sinad



Mime
View raw message