From: han.lu@intel.com
To: tiwai@suse.de, liam.r.girdwood@linux.intel.com,
alsa-devel@alsa-project.org
Cc: "Lu, Han" <han.lu@intel.com>
Subject: [PATCH 1/1] alsabat: add terminate status check for capture thread
Date: Sun, 17 Apr 2016 09:26:45 +0800 [thread overview]
Message-ID: <1460856405-28390-1-git-send-email-han.lu@intel.com> (raw)
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
next reply other threads:[~2016-04-17 1:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-17 1:26 han.lu [this message]
2016-04-18 14:35 ` [PATCH 1/1] alsabat: add terminate status check for capture thread Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460856405-28390-1-git-send-email-han.lu@intel.com \
--to=han.lu@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox