Menu

Close
  • 首页
Subscribe
Menu

condition variable

A 1-post collection

Page 1 of 1

关于锁的总结(二)条件变量

条件变量 互斥器用于互斥,条件变量用于等待 如果上例子中消费者和生产者同时并发,那么需要消费者需要轮询(polling)或者轮转(spinning) 查询buf状态,看是否满足消费条件 void comsume_wait(int i) { for( ; ; ) { pthread_mutex_lock(&shared.mutex); if (i < shared. »

chainhelen on 锁, condition variable, 条件变量, 观察者模式, 线程状态, 阻塞 23 May 2018
Page 1 of 1
chainhelen blog © 2025
Proudly published with Ghost