CnUnix

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ CnUnix ] in KIDS
글 쓴 이(By): unixboy (세탁소주인)
날 짜 (Date): 2003년 4월  8일 화요일 오후 07시 32분 26초
제 목(Title): Simple Question about PIPE



Again, great apology to give you great stress
to interpret such a poor english. No imposement
for reading this ugly question. 

Hmm, I found that the control fell into the
"pthread_cond_wait()" and NEVER escape from that
function though I sent numerous signals with 
"pthread_cond_signal()". Please, would you let 
me know anything wrong in the following statements?


Sender:
void
read_message(MSG_QUEUE *mq,int callnum)
{
   pthread_mutex_lock( mq->lock );

   while( mq->sent-mq->read == 0 )
pthread_cond_wait( mq->lock );

   ....
   ....

   pthread_mutex_unlock( mq->lock );
}

Reader:
void
send_message(MSG_QUEUE *mq,int callnum)
{
   pthread_mutex_lock( mq->lock );

   ...
   ...

   pthread_cond_signal( mq->lock );

   pthread_mutex_unlock( mq->lock );
}

Oh, Sender, Reader should be exchanged. ^^ 
A curious thing is that reader function had never
been signalled by send_message() function through
pthread_cond_signal(). 

The version of pthread is 0.9. 
Please, give me any comment about this chaotic situation.



@@ 나비처럼 날아서 벌처럼 도배하자 @@
[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.