84

使用双buffer无锁化 | 一根笨茄子

 6 years ago
source link: http://guoyb.com/2018/03/17/double-buffer/?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
使用锁面对多线程读写同一块内存的情况,书接上文读写锁的性能一定更好吗,假设我们已经选定了一种锁,那么最直接想到的做法是一般这样的: 1234567891011// write thread{ LockGuard guard(lock); obj.load(); // load会对obj的属性进行重写}// read thread{ LockGuard

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK