I've written a fork()ing server which I'm using very happily.
However I've run into a problem where I wish to persist some data between clients, as the forked() children cannot modify the variables stored in the parent I've fudged this by using FreezeThaw to persist the data to a temporary file.
This works .. mostly .. but there are issues with synchronization which appear to cause the temporary file to get trashed.
As I see it I can continue down this route and add locking - or I can solve the problem the right way by creating a shared memory segment in the parent, and writing a hash to that from the client.
(Each client can write to %persistence{clientip} - as I know that each client connects only once).
So my questions begin, how can I manage this? Is there some sample somewhere that I can copy?
I've looked around and I honestly see no real examples of using IPC shared memory under perl.
In reply to Use of shared memory to persist data between child processes by skx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |