2018年1月7日

摘要: 先来几个同义词readers–writer (RW) lockshared - exclusive lockmultiple readers/single-writer lockmulti-reader lock push lock解决的问题允许多个线程同时读取数据。只允许一个线程写或更新数据写数据时,其他的写操作和读操作要被阻塞。(SQLite 的 WAL 不是,允许同时读写)实现时需要考虑的问... 阅读全文
posted @ 2018-01-07 22:59 花老🐯 阅读(1237) 评论(0) 推荐(0) 编辑
摘要: 条件变量是一种同步机制,允许线程挂起,直到共享数据上的某些条件得到满足。条件变量上的基本操作有:触发条件(当条件变为 true 时);等待条件,挂起线程直到其他线程触发条件 while ()为什么是while而不是if?因为可能会有虚假唤醒的问题。 "This means that when you wait on a condition variable, the wait may (o... 阅读全文
posted @ 2018-01-07 10:41 花老🐯 阅读(244) 评论(0) 推荐(0) 编辑

导航