A
Axel Boldt
Hello,
I want to share a hash variable among several forked processes.
Ideally I would use threads and threads::shared, but I need LWP which
is not thread-safe. So I thought about using DB_FILE and a hash
variable tied to the same file in each of the processes. If one
process changes the hash variable, all others should see the change
immediately. I.e. I want that the change is immediately flushed to
disk, and that every access to the hash variable takes its value
directly from disk, not from some internal cache. Is that possible? I
have tried the O_SYNC flag for db_open and also the $db->sync() method
to no avail.
If it's not possible, what do people usually do to keep a set of
cooperating processes informed about the results that the other
processes have already computed?
Thanks,
Axel
I want to share a hash variable among several forked processes.
Ideally I would use threads and threads::shared, but I need LWP which
is not thread-safe. So I thought about using DB_FILE and a hash
variable tied to the same file in each of the processes. If one
process changes the hash variable, all others should see the change
immediately. I.e. I want that the change is immediately flushed to
disk, and that every access to the hash variable takes its value
directly from disk, not from some internal cache. Is that possible? I
have tried the O_SYNC flag for db_open and also the $db->sync() method
to no avail.
If it's not possible, what do people usually do to keep a set of
cooperating processes informed about the results that the other
processes have already computed?
Thanks,
Axel