[ALSA] Fix possible races in timer callbacks

Fix possible races in timer callbacks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai
2005-11-18 18:52:14 +01:00
committed by Jaroslav Kysela
parent 2eb061f41c
commit b32425ac93
6 changed files with 20 additions and 15 deletions

View File

@ -662,12 +662,13 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
struct snd_timer_instance *ti, *ts;
unsigned long resolution, ticks;
struct list_head *p, *q, *n, *ack_list_head;
unsigned long flags;
int use_tasklet = 0;
if (timer == NULL)
return;
spin_lock(&timer->lock);
spin_lock_irqsave(&timer->lock, flags);
/* remember the current resolution */
if (timer->hw.c_resolution)
@ -752,7 +753,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
/* do we have any slow callbacks? */
use_tasklet = !list_empty(&timer->sack_list_head);
spin_unlock(&timer->lock);
spin_unlock_irqrestore(&timer->lock, flags);
if (use_tasklet)
tasklet_hi_schedule(&timer->task_queue);