<p>Hi, Mickael!</p>

<p>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.<br>
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.<br>
Therefore, I think your bug is somewhere else.</p>

<p>[1] <a href="http://lxr.free-electrons.com/source/arch/x86/include/asm/atomic.h#L37">http://lxr.free-electrons.com/source/arch/x86/include/asm/atomic.h#L37</a></p>

<p>Best regards,<br>
Răzvan</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/396#issuecomment-67347088">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOcicCJI8AIdolgeSRjLzPInxc37VK9ks5nYaRxgaJpZM4DJhfJ.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/396#issuecomment-67347088"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>