dp_stop_sound_race_lock.diff

Blub, 05/24/2009 04:24 pm

Download (1.1 KB)

 
snd_main.c (working copy)
1476 1476
	if (channel_ind >= total_channels)
1477 1477
		return;
1478 1478

  
1479
	// we have to lock an audio mutex to prevent crashes if an audio mixer
1480
	// thread is currently mixing this channel
1481
	// the SndSys_LockRenderBuffer function uses such a mutex in
1482
	// threaded sound backends
1483
	if (lockmutex)
1484
		SndSys_LockRenderBuffer();
1485
	
1479 1486
	ch = &channels[channel_ind];
1480 1487
	if (ch->sfx != NULL)
1481 1488
	{
1482 1489
		sfx_t *sfx = ch->sfx;
1483 1490

  
1484
		// we have to lock an audio mutex to prevent crashes if an audio mixer
1485
		// thread is currently mixing this channel
1486
		// the SndSys_LockRenderBuffer function uses such a mutex in
1487
		// threaded sound backends
1488
		if (lockmutex)
1489
			SndSys_LockRenderBuffer();
1490 1491
		if (sfx->fetcher != NULL)
1491 1492
		{
1492 1493
			snd_fetcher_endsb_t fetcher_endsb = sfx->fetcher->endsb;
......
1499 1500

  
1500 1501
		ch->fetcher_data = NULL;
1501 1502
		ch->sfx = NULL;
1502
		if (lockmutex)
1503
			SndSys_UnlockRenderBuffer();
1504 1503
	}
1504
	if (lockmutex)
1505
		SndSys_UnlockRenderBuffer();
1505 1506
}
1506 1507

  
1507 1508