From: MLM Veraart (veraart++at++fel.tno.nl)
Date: 04/10/2003 11:40:16
Stephen Jeffrey wrote:
>
> Hi,
>
> I want to allocate data from the shared memory arena
> after calling pfConfig, and then access that data in
> the APP and DRAW processes. If the data in the arena
> is modified in the APP process, the change is not seen
> in the DRAW process. Also, when pfGetArena(data) is
> called from the DRAW process it returns NULL ie. it
> claims the data is not stored in the shared memory
> arena, yet when called from the APP process it correctly
> returns the address of the arena.
>
> It appears as though each process is getting its own
> copy of the data, and not sharing a single copy in
> the shared memory arena.
>
> A modified version of the performer demo code "basic.C"
> is shown below which exhibits the problem.
>
> Any ideas?
>
> cheers
> steve
Hi Steve,
The problem is that only the value of global variables before pfConfig()
is shared over all processes.
The solution if you want to allocate after pfConfig() is to use a structure
with the global pointer variables allocated in shared memory before pfConfig.
The pointers in this struct can be read and written by all processes.
Take a look at complex.C and the Shared data class it uses.
Mario
This archive was generated by hypermail 2b29 : Thu Apr 10 2003 - 11:42:21 PDT