mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 18:56:32 +01:00
alsabat: add terminate status check for capture thread
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@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
85827fbb64
commit
569f2c116e
1 changed files with 6 additions and 0 deletions
|
@ -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"),
|
||||
|
|
Loading…
Reference in a new issue