@@ -870,18 +870,20 @@ static void virtio_queue_notify_handler(
870870static void * func (void * args )
871871{
872872 virtio_snd_state_t * vsnd = (virtio_snd_state_t * ) args ;
873- fprintf (stderr , "*** tx desc handler is called ***\n" );
874- pthread_mutex_lock (& virtio_snd_mutex );
875- while (tx_ev_notify <= 0 ) {
876- pthread_cond_wait (& virtio_snd_tx_cond , & virtio_snd_mutex );
877- fprintf (stderr , "wait for cond\n" );
873+ for (;;) {
874+ fprintf (stderr , "*** tx desc handler is called ***\n" );
875+ pthread_mutex_lock (& virtio_snd_mutex );
876+ while (tx_ev_notify <= 0 ) {
877+ pthread_cond_wait (& virtio_snd_tx_cond , & virtio_snd_mutex );
878+ fprintf (stderr , "wait for cond\n" );
879+ }
880+ fprintf (stderr , "*** start tx critical section ***\n" );
881+ tx_ev_notify -- ;
882+ fprintf (stderr , "*** tx desc handler ***\n" );
883+ virtio_queue_notify_handler (vsnd , 2 , virtio_snd_tx_desc_handler );
884+ fprintf (stderr , "*** end tx cirtical section ***\n" );
885+ pthread_mutex_unlock (& virtio_snd_mutex );
878886 }
879- fprintf (stderr , "*** start tx critical section ***\n" );
880- tx_ev_notify -- ;
881- fprintf (stderr , "*** tx desc handler ***\n" );
882- virtio_queue_notify_handler (vsnd , 2 , virtio_snd_tx_desc_handler );
883- fprintf (stderr , "*** end tx cirtical section ***\n" );
884- pthread_mutex_unlock (& virtio_snd_mutex );
885887 return NULL ;
886888}
887889
0 commit comments