in reply to IPC:Shareable: Not an array reference
Anyway, from looking at your code, the first thing that jumps out at me is: where are the locks? If you have shared memory, your processes must implement some form of locking otherwise you have a mess where 2 folks are trying to modify the same structure at once. It is up to the user to implement these locks between processes. IPC:Shareable shows the shlock() and shunlock() functions. shift @data; is a "read-modify-write" operation.
Update: Oh, I see I guess you are figuring that the sleep(1) in the child is enough?
From looking at the example in the doc's, I think you need different values for "create" and "destroy" between the 2 processes. Why is tie commented out in the child? Shouldn't the sleep 1 go before the tie to allow time for the parent to create this shared array in the first place? I would simplify things and replace the for loop in the child with a simple, print "@data";.
|
|---|