pthread-barriers

How to use pthreads barrier?

主宰稳场 提交于 2019-12-21 13:14:31
问题 Hi Sorry for posting a big dump of code but I'm very new at C code, Basically I'm doing an assignment for college and and I have to implement a "pthread_barrier", now I understand the concept of the barrier (or at least I think I do) But I am just not sure exactly where I should put it. The assignment states: "Use pthread_barrier_init and pthread_barrier_wait to ensure that all producer/consumer threads begin producing/consuming at the same time." This is the extra credit part of the

How to use pthreads barrier?

╄→гoц情女王★ 提交于 2019-12-04 07:21:36
Hi Sorry for posting a big dump of code but I'm very new at C code, Basically I'm doing an assignment for college and and I have to implement a "pthread_barrier", now I understand the concept of the barrier (or at least I think I do) But I am just not sure exactly where I should put it. The assignment states: "Use pthread_barrier_init and pthread_barrier_wait to ensure that all producer/consumer threads begin producing/consuming at the same time." This is the extra credit part of the assignment by the way #include <pthread.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> #define