Hello all,

I have observed a certain difference between DBM and SDBM, but I would
like to confirm them with someone more experienced and I also would
like to know if I can rely on these observations.

It seems to me that if I open a DBM file and then fork my process, the
parent and the child will not see modifications made by each other to
the DBM instantly. However, SDBM allows the DBM to be shared among
several processes.

Is that correct?

Roughly, my code was

apr_dbm_open(&dbm)

if(fork() == 0) {
   sleep(1); // sleep for 1 second
   apr_dbm_fetch(dbm, "my_key", &value);
}
else {
   apr_dbm_store(dbm, "my_key", "my_value");
}

Of course, I used apr_datum_t's instead of pure strings.

When I used the code above, the child process would not see the data
stored by the parent. However, by replacing the DBM calls to SDBM
calls, it worked.

Thanks in advance,

--
César L. B. Silveira
http://cesarbs.wordpress.com/

Reply via email to