From alsa-devel-owner@alsa.jcu.cz  Mon Jun 29 21:27:08 1998
Received: from altrade.nijmegen.inter.nl.net (altrade.nijmegen.inter.nl.net [193.67.237.6])
	by marvin.jcu.cz (8.8.8/8.8.8) with ESMTP id VAA31484
	for <alsa-devel@jcu.cz>; Mon, 29 Jun 1998 21:25:19 +0200
Received: from obelix.fvdpol.inter.nl.net by altrade.nijmegen.inter.nl.net
	via bd99-2.Breda.NL.net [193.79.246.227] with ESMTP for <alsa-devel@jcu.cz>
	id VAA13873 (8.8.8/3.28); Mon, 29 Jun 1998 21:25:13 +0200 (MET DST)
Received: (from frank@localhost) by obelix.fvdpol.inter.nl.net (8.8.7/8.7.3) id UAA14556 for alsa-devel@jcu.cz; Mon, 29 Jun 1998 20:26:18 +0200
From: Frank van de Pol <F.K.W.van.de.Pol@inter.nl.net>
Message-Id: <199806291826.UAA14556@obelix.fvdpol.inter.nl.net>
Subject: usage of snd_spin_lock()
To: alsa-devel@jcu.cz (alsa)
Date: Mon, 29 Jun 1998 20:26:18 +0200 (MET DST)
Content-Type: text
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list


It seems to me that to prevent multiple programs accessing the same critial
section (en thus risking corruption of data structures) the snd_spin_lock()
and snd_spin_unlock() are provided.

How should these be used when the 'other' thread is interrupt code?

Example:

A kernel module is executing a function, and the entry of a section is
locked.

	...
	snd_spin_lock();
	...
	blah blah 
	processing	<---- this code is executing at this moment.
	...
	snd_spin_unload();

Now a hardware interrupt is generated, and that interrupt code tries to
enter the same code fragment. What now? It can't enter because the lock is
raised, but the lock won't be freed because the code that was executing is
interrupted and won't reach the snd_spin_unlock()... 

Is this a deadlock scenario or is there more magic involved which I did
overlook?

Regards,
Frank.


+---- --- -- -  -   -    - 
|Frank van de Pol                  -o)
|F.K.W.van.de.Pol@inter.NL.net     /\\
|                                 _\_v
|Linux - Why use Windows, since there is a door?

