[Vorbis-dev] Thread Problem.

William Ahern william at 25thandClement.com
Sat May 26 22:43:56 PDT 2012


On Sat, May 26, 2012 at 11:54:56PM -0400, Ryan Sullivan wrote:
<snip>
> occurs. It seems the code is not thread safe and I've tried a bunch of
> things with mutexes or changes to the code but have not had success with
> this so far. The crash will either occur in ov_read or at random points
> within the main thread of the game. (such as doing change animation calls
> or cases where the game won't crash if music isn't using it's own thread)
> I'm going to send basically what I hope to be the only relevant code for
> the music and see if anyone has any suggestions on what I can do to fix
> this problem.

AFAIK, libvorbis and libogg are passively thread safe in the sense used by
Unix programmers: contexts don't access shared, mutable storage. For Windows
programmers, thread-safe usually means that the library actively uses
mutexes internally so that the same context can be used from multiple
threads out-of-the-box. This is not the case for libvorbis and libogg. You
need to explicitly synchronize use of the API over each object. I don't see
any locking in the code you posted.

Have you used a debugger? Valgrind, Purify, dbx, etc? Valgrind, for example,
can diganose mutex issues by tracking mutex use and data access among
threads.

FWIW, this list is pretty much dead. We may be the only ones subscribed and
paying attention.



More information about the Vorbis-dev mailing list