[OpenSIPS-Devel] [opensips] In rw_locking.h, should the statement (_lock)->w_flag = 0 be executed under lock? (#396)

Răzvan Crainea notifications at github.com
Wed Dec 17 17:18:57 CET 2014


Hi, Mickael!

On most of the modern architectures, the assignment is guaranteed to be atomic. On x86 machines, it definitely is. For example, check how the atomic_set() function is implemented in the linux kernel[1]. As you can see it is a simple, unguarded assignment.
When we implemented the rw_locking mechanism we evaluated whether to use the locking or not, and decided that for performance reasons, we should not.
Therefore, I think your bug is somewhere else.

[1] http://lxr.free-electrons.com/source/arch/x86/include/asm/atomic.h#L37

Best regards,
Răzvan

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/396#issuecomment-67347088
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20141217/b7836dc4/attachment.htm>


More information about the Devel mailing list