From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH 1/1] alsabat: add terminate status check for capture thread Date: Mon, 18 Apr 2016 16:35:08 +0200 Message-ID: References: <1460856405-28390-1-git-send-email-han.lu@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BC4E826154C for ; Mon, 18 Apr 2016 16:35:11 +0200 (CEST) In-Reply-To: <1460856405-28390-1-git-send-email-han.lu@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: han.lu@intel.com Cc: liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Sun, 17 Apr 2016 03:26:45 +0200, han.lu@intel.com wrote: > > From: "Lu, Han" > > 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 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 >