Skip to content

Commit a61e1aa

Browse files
committed
Refine tx_mutex
1 parent 6fe883d commit a61e1aa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

virtio-snd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,9 @@ static void virtio_snd_read_pcm_prepare(const virtio_snd_pcm_hdr_t *query,
526526
return;
527527
}
528528

529-
/* Control the callback to prepare the buffer */
530-
/* TODO: add lock to avoid race condition */
531-
// pthread_mutex_lock(&virtio_snd_mutex);
532529
props->v.guest_playing = 0;
533530
props->v.stream_id = stream_id;
534-
// pthread_mutex_unlock(&virtio_snd_mutex);
531+
535532
props->pp.hdr.hdr.code = VIRTIO_SND_R_PCM_PREPARE;
536533
uint32_t period_bytes = props->pp.period_bytes;
537534
uint32_t channels = props->pp.channels;
@@ -1130,6 +1127,7 @@ static void virtio_queue_notify_handler(
11301127
}
11311128

11321129
/* TX thread context */
1130+
/* Control the callback to prepare the buffer */
11331131
static void *func(void *args)
11341132
{
11351133
virtio_snd_state_t *vsnd = (virtio_snd_state_t *) args;

0 commit comments

Comments
 (0)