From alsa-devel-owner@alsa.jcu.cz  Sat Feb 20 15:17:29 1999
Received: from entry.jcu.cz (IDENT:perex@entry.jcu.cz [160.217.1.111])
	by marvin.jcu.cz (8.9.1a/8.9.1) with SMTP id PAA15334;
	Sat, 20 Feb 1999 15:17:15 +0100
Date: Sat, 20 Feb 1999 15:17:15 +0100 (CET)
From: Jaroslav Kysela <perex@jcu.cz>
To: Harald Kirsch <kir@iitb.fhg.de>
cc: alsa-devel@alsa.jcu.cz
Subject: Re: alsa
In-Reply-To: <19990219174549.A6003@neptun.iitb.fhg.de>
Message-ID: <Pine.LNX.3.96.990220145113.29496F-100000@entry.jcu.cz>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

On Fri, 19 Feb 1999, Harald Kirsch wrote:

> Hi there,
> 
> I am successfully using your alsa software and I am quite happy with
> it.
> 
> Nevertheless I have an observation for which I don't know if it is a bug 
> or a feature.
> 
> I have a written a sound-player which is supposed to report the time
> elapsed since playing started whenever it receives a SIGINT or
> SIGUSR. It works quite well as long as write-calls are running. The
> unexpected behaviour is observed with the close system call. Close
> returns as soon as the signal arrives and without any indication that
> not all data were written. But indeed pending data is not written to the
> card, which can be verfied by not hearing the end of the sound data.
> 
> Although I cannot find any indication in the manual page for close that
> it may return EINTR or EAGAIN, I wonder if the observed behaviour is in
> accordance with UNIX/POSIX semantic of `close'. 

I think that EINTR or EAGAIN result codes cannot be used for close().
How would you solve a situtation when an user program crashes and
the kernel must close all opened files?

> Currently I am using the oss-compatible device /dev/dsp. Is there a
> different behaviour with the alsa-native devices?

I tried to modify flush() functions to return EINTR and EAGAIN error codes
for the native PCM interface. You can use now:

	open(native_ALSA_PCM_device);
	write(data);
	while (flush() != (-EINTR || -EAGAIN));
	close();

							Jaroslav

-----
Jaroslav Kysela <perex@jcu.cz>
Academic Computer Centre, University of South Bohemia
Branisovska 31, C. Budejovice, CZ-370 05 Czech Republic


