asmttpd icon indicating copy to clipboard operation
asmttpd copied to clipboard

Missing memory fences in mutexes

Open socketpair opened this issue 3 years ago • 1 comments

https://en.m.wikipedia.org/wiki/Memory_barrier#Multithreaded_programming_and_memory_visibility

You need mfence/lfence/sfence before mutex_lock() returns, and before unlock() returns.

socketpair avatar May 03 '21 16:05 socketpair

Thread 1: Lock A=1 Unlock

Thread 2: Lock Read A. May see old, not updated by thread 1 value.

socketpair avatar May 03 '21 16:05 socketpair