[PATCH 1/1] alsabat: add terminate status check for capture thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Lu, Han" <han.lu@xxxxxxxxx>

In loopback test, alsabat use pthread_join(pthread_t thread, **retval)
to wait for the capture thread to terminate. If the capture thread was
canceled, PTHREAD_CANCELED is placed in *retval, and the access to the
**retval will fail. Add status check to prevent illegal access to the
**retval.

Signed-off-by: Lu, Han <han.lu@xxxxxxxxx>

diff --git a/bat/bat.c b/bat/bat.c
index e824065..1afdcb4 100644
--- a/bat/bat.c
+++ b/bat/bat.c
@@ -192,6 +192,12 @@ static void test_loopback(struct bat *bat)
 		exit(EXIT_FAILURE);
 	}
 
+	/* check if capture thread is canceled or not */
+	if (thread_result_capture == PTHREAD_CANCELED) {
+		fprintf(bat->log, _("Capture canceled.\n"));
+		return;
+	}
+
 	/* check capture status */
 	if (*thread_result_capture != 0) {
 		fprintf(bat->err, _("Exit capture thread fail: %d\n"),
-- 
2.5.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux