0

In https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_12 it is said that recursive mutexes need not to synchronize memory.

In my understanding, they therefore do not need to establish a memory-barrier. Should I then use a memory-barrier explicitly? Say: use asm volatile ("" ::: "memory"); ?

wimalopaan
  • 4,838
  • 1
  • 21
  • 39
  • 1
    Recursive mutexes that a thread already owns don't need to synchronize, since they already did when they locked the first time. Likewise, a not fully unlocked recursive mutex doesn't need to synchronize because it's still owned. Why would you want an explicit memory barrier? – Hasturkun Dec 14 '22 at 10:15
  • Oh yes, thanks! I just did not obey the phrase " ... and the calling thread already owns the mutex". – wimalopaan Dec 14 '22 at 10:22

0 Answers0