Mercurial > hg > Members > masakoha > testcode
diff parallel_processing/ppb_cond_queue/ppb_queue.h @ 21:d137f1823794
fix (but cannot running)
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 07 Jan 2014 14:15:51 +0900 |
parents | 28cac8b199cb |
children |
line wrap: on
line diff
--- a/parallel_processing/ppb_cond_queue/ppb_queue.h Tue Jan 07 00:37:27 2014 +0900 +++ b/parallel_processing/ppb_cond_queue/ppb_queue.h Tue Jan 07 14:15:51 2014 +0900 @@ -7,6 +7,7 @@ #define MAX_QUEUE_NUM 10 #endif /* MAX_QUEUE_NUM */ +/* typedef struct _queue { int values[MAX_QUEUE_NUM]; volatile int remain; @@ -15,11 +16,12 @@ pthread_cond_t not_full; pthread_cond_t not_empty; } queue_t; +*/ void enqueue(queue_t *q, int v) { pthread_mutex_lock(&q->mutex); while (q->remain == MAX_QUEUE_NUM) - pthread_cond_wait(&q->not_fill, &q->mutex); + pthread_cond_wait(&q->not_full, &q->mutex); q->values[q->wp] = v; q->wp++; q->remain++; if (q->wp == MAX_QUEUE_NUM) q->wp = 0;