[Kamailio-Devel] Conditional lock_get()
Iñaki Baz Castillo
ibc at aliax.net
Fri Jan 9 19:00:26 CET 2009
Hi, I've a PCRE compiled object in shared memory.
As far as I read in PCRE documentation, multi-threading read access to the
same PCRE object is 100% safe so theorically I don't need to use a lock when
a Kamailio process access to this PCRE object (this would be done in a script
function).
But I've also a MI command that recompile the PCRE object, so during the
compilation a lock must exist. This requires "lock_get()" when a process
tries to read the PCRE object. But this would cause that different processes
couldn't read the PCRE in parallel, even if it's 100% safe.
Anyway, if I get the desired behaviour it could occur that a process is
reading the PCRE (so without "lock_get()") and at the same time the MI
function modifies it, which could cause a segmentation fault.
Any suggestion? Perhaps I should use "lock_get()" in each read access? It's
the simplest solution, but what about performance?
Thanks.
--
Iñaki Baz Castillo
More information about the Devel
mailing list