How to use pthreads barrier?

╄→гoц情女王★ 提交于 2019-12-04 07:21:36

I could probably give you the full answer but I am afraid of Lasse V. Karlsen. So I'll give you hints.

  • The barrier object bar is already accessible in your struct cp_t
  • Initialize it with pthread_barrier_init, like you initialized the mutexes. There is a correspondence between countand the number of actors.
  • Both the producers and consumers need to wait before starting to produce / consume. Get it ?
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!