Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 214697 - games-emulation/zsnes-1.51-r1 problem with libao/alsa
Summary: games-emulation/zsnes-1.51-r1 problem with libao/alsa
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Timothy Redaelli (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-25 14:28 UTC by James L. Hammons
Modified: 2008-05-09 19:15 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Tested ebuild with new patch included (zsnes-1.51-r2.ebuild,2.20 KB, text/plain)
2008-04-02 12:55 UTC, James L. Hammons
Details
The patch (zsnes-1.51-libao-thread.patch,663 bytes, patch)
2008-04-02 12:57 UTC, James L. Hammons
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James L. Hammons 2008-03-25 14:28:27 UTC
For libao to work properly the audio thread has to be created *after* the mutex and condition is created otherwise the sound thread has a chance to deadlock (as it was wont to do on my machine before I applied this patch :).

I can't take credit for this fix as it was posted on one of the zsnes dev sites. As such, it's probably already upstream. But in lieu of an upstream version bump any time soon, I think this patch should be rolled in here as -r2.

Patch below comes from http://board.zsnes.com/phpBB2/viewtopic.php?p=157699&sid=4ead2f9a94c153be8e85916ad6ac2f8b

--------------------------------------------------------------------------

diff -ur zsnes-1.510/src/linux/audio.c zsnes-1.510-new/src/linux/audio.c 
--- zsnes-1.510/src/linux/audio.c   2007-01-09 20:19:12.000000000 -0500 
+++ zsnes-1.510-new/src/linux/audio.c   2007-12-30 20:33:07.000000000 -0500 
@@ -177,11 +177,7 @@ 
   } 
   else 
   { 
-    if (pthread_create(&audio_thread, 0, SoundThread_ao, 0)) 
-    { 
-      puts("pthread_create() failed."); 
-    } 
-    else if (pthread_mutex_init(&audio_mutex, 0)) 
+    if (pthread_mutex_init(&audio_mutex, 0)) 
     { 
       puts("pthread_mutex_init() failed."); 
     } 
@@ -189,6 +185,10 @@ 
     { 
       puts("pthread_cond_init() failed."); 
     } 
+    else if (pthread_create(&audio_thread, 0, SoundThread_ao, 0)) 
+    { 
+      puts("pthread_create() failed."); 
+    } 
     InitSampleControl(); 
   }
Comment 1 James L. Hammons 2008-04-02 12:55:50 UTC
Created attachment 148077 [details]
Tested ebuild with new patch included
Comment 2 James L. Hammons 2008-04-02 12:57:08 UTC
Created attachment 148078 [details, diff]
The patch
Comment 3 Timothy Redaelli (RETIRED) gentoo-dev 2008-05-09 19:15:11 UTC
Fixed, thanks