On Wed, Aug 21, 2002 at 08:06:41AM -0700, Ian Holsman wrote:
> 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.

If you are playing with shmem on a linux box, you will probably need
to manually free segments from time to time.

#  ipcs -m
key        shmid      owner      perms      bytes      nattch     status
0x00000000 12345      www-data  600        92164      0          dest

will give you the list of share memory segments in use. The "nattch"
field gives you the ref count.
  iprm shm 12345
will free up that memory segment so it can be re-attached.

> > 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
> 

-- 
-eric

([EMAIL PROTECTED])
Feel free to forward this message to any list for any purpose other than
email address distribution.

Reply via email to