5 ms·
lock io_mutex; print \*x; unlock io_mutex; Have you ever looked at lock/unlock code? There's a memory + compiler barrier inside of any mutex. The easi
by dragontamer 4y ago
lock io_mutex;
print \*x;
unlock io_mutex;
Have you ever looked at lock/unlock code? There's a memory + compiler barrier inside of any mutex.
The easiest way to use memory barriers is through locking/unlocking mutexes. Alas, that's too slow for a number of applications, so advanced programmers have begun to use more complicated patterns.