Mercurial > pt1
comparison recpt1/recpt1.c @ 27:763cf84d2dc7
fixed a bug that waited for wrong cond variable
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 28 Feb 2009 04:21:31 +0900 |
parents | c6264c15f39d |
children | 97c820e30737 |
comparison
equal
deleted
inserted
replaced
26:c6264c15f39d | 27:763cf84d2dc7 |
---|---|
149 pthread_mutex_lock(&p_queue->mutex); | 149 pthread_mutex_lock(&p_queue->mutex); |
150 /* entered the critical section*/ | 150 /* entered the critical section*/ |
151 | 151 |
152 /* wait while queue is empty */ | 152 /* wait while queue is empty */ |
153 while(p_queue->num_used == 0) { | 153 while(p_queue->num_used == 0) { |
154 pthread_cond_timedwait(&p_queue->cond_avail, | 154 pthread_cond_timedwait(&p_queue->cond_used, |
155 &p_queue->mutex, &spec); | 155 &p_queue->mutex, &spec); |
156 if(f_exit) { | 156 if(f_exit) { |
157 pthread_mutex_unlock(&p_queue->mutex); | 157 pthread_mutex_unlock(&p_queue->mutex); |
158 return NULL; | 158 return NULL; |
159 } | 159 } |