httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pranesh Vadhirajan" <vadhira...@teralogics.com>
Subject RE: Apache shared memory implementation
Date Thu, 17 Nov 2011 00:55:36 GMT
Thanks Sorin.  The program worked fine when I made the changes you
suggested(I had to change the last line to "++((int) *shm_base);").  Can I
employ the same idea when it comes to more complicated structures?  I will
be making my own implementation of a linked list as a shared memory
structure?  Suppose, that the list is declared as "list *my_list", can I
just call set_shared region like this: set_shared_region(&my_list) ? Would
this work?

-----Original Message-----
From: Sorin Manolache [mailto:sorinm@gmail.com] 
Sent: Wednesday, November 16, 2011 5:51 PM
To: modules-dev@httpd.apache.org
Subject: Re: Apache shared memory implementation

You have some problems with the pointers.

You should have

void *shm_base;

and then

set_shared_region(void **base) {
 ...
 *base = mmap(...);
 if (*base == MAP_FAILED) { ... }
 ...
}

set_shared_region(&shm_base);

and when you increment the counter, you do

++((int *)shm_base);

--
S

Mime
View raw message