alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@kernel.org>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	patches@opensource.wolfsonmicro.com, vinod.koul@linux.intel.com,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH 2/2 v2] crec: Add primitive exception	handling
Date: Wed, 11 Dec 2013 11:15:51 +0000	[thread overview]
Message-ID: <20131211111551.GA13948@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20131203182256.GL27568@sirena.org.uk>

On Tue, Dec 03, 2013 at 06:22:56PM +0000, Mark Brown wrote:
> On Tue, Dec 03, 2013 at 04:27:55PM +0000, Charles Keepax wrote:
> 
> > +static void sig_handler(int signum __attribute__ ((unused)))
> > +{
> > +	printf("Interrupted, saving what we have!\n");
> > +
> > +	finish_record();
> > +
> > +	if (file)
> > +		fclose(file);
> > +
> > +	_exit(EXIT_FAILURE);
> > +}
> 
> You can't safely do most of this such as calling fclose() from within a
> signal handler, the set of functions that are guaranteed safe is quite
> limited - see signal(7).

A cool thing would be to use signalfd(2) to serialize the handling of the
signal and getting rid of the traditional signal handler.

>From a quick look at bionic it doesn't seem to define a syscall wrapper for that
so if one really wanted to use it, it would be through syscall(2) but that's
a bit ugly for this purpose.

Thanks,
Dimitris

      parent reply	other threads:[~2013-12-11 11:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 16:27 [PATCH 1/2 v2] crec: Initial version of a compressed capture utility Charles Keepax
2013-12-03 16:27 ` [PATCH 2/2 v2] crec: Add primitive exception handling Charles Keepax
2013-12-03 18:22   ` Mark Brown
2013-12-03 20:18     ` Mark Brown
2013-12-05 14:25       ` Charles Keepax
2013-12-05 14:57         ` Mark Brown
2013-12-08 14:47           ` Charles Keepax
2013-12-11 11:15     ` Dimitris Papastamos [this message]

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=20131211111551.GA13948@opensource.wolfsonmicro.com \
    --to=dp@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=vinod.koul@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).