* [PATCH 1/1] alsabat: add terminate status check for capture thread
@ 2016-04-17 1:26 han.lu
2016-04-18 14:35 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: han.lu @ 2016-04-17 1:26 UTC (permalink / raw)
To: tiwai, liam.r.girdwood, alsa-devel; +Cc: Lu, Han
From: "Lu, Han" <han.lu@intel.com>
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>
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] alsabat: add terminate status check for capture thread
2016-04-17 1:26 [PATCH 1/1] alsabat: add terminate status check for capture thread han.lu
@ 2016-04-18 14:35 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2016-04-18 14:35 UTC (permalink / raw)
To: han.lu; +Cc: liam.r.girdwood, alsa-devel
On Sun, 17 Apr 2016 03:26:45 +0200,
han.lu@intel.com wrote:
>
> From: "Lu, Han" <han.lu@intel.com>
>
> 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>
Applied, thanks.
Takashi
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-18 14:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-17 1:26 [PATCH 1/1] alsabat: add terminate status check for capture thread han.lu
2016-04-18 14:35 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox