19 |
|
#include "func.h" |
20 |
|
#include "bsdf.h" |
21 |
|
|
22 |
+ |
char *shm_boundary = NULL; /* boundary of shared memory */ |
23 |
|
|
24 |
+ |
|
25 |
|
/* KEEP THIS ROUTINE CONSISTENT WITH THE DIFFERENT OBJECT FUNCTIONS! */ |
26 |
|
|
27 |
|
|
176 |
|
/* note that nobjects may change during loop */ |
177 |
|
for (on = 0; on < nobjects; on++) |
178 |
|
load_os(objptr(on)); |
179 |
+ |
} |
180 |
+ |
|
181 |
+ |
|
182 |
+ |
void |
183 |
+ |
cow_memshare(void) /* set up copy-on-write memory sharing */ |
184 |
+ |
{ |
185 |
+ |
if (shm_boundary != NULL) |
186 |
+ |
return; /* assume we're good */ |
187 |
+ |
|
188 |
+ |
preload_objs(); /* preload auxiliary data */ |
189 |
+ |
/* set shared memory boundary */ |
190 |
+ |
shm_boundary = (char *)malloc(16); |
191 |
+ |
strcpy(shm_boundary, "SHM_BOUNDARY"); |
192 |
+ |
} |
193 |
+ |
|
194 |
+ |
|
195 |
+ |
void |
196 |
+ |
cow_doneshare(void) /* clear memory sharing boundary */ |
197 |
+ |
{ |
198 |
+ |
if (shm_boundary == NULL) |
199 |
+ |
return; |
200 |
+ |
/* clear shared memory boundary */ |
201 |
+ |
free((void *)shm_boundary); |
202 |
+ |
shm_boundary = NULL; |
203 |
|
} |