[vorbis-dev] BeOS on PPC compile, thread question.

Monty xiphmont at xiph.org
Wed Nov 15 14:50:11 PST 2000



> Let me throw in my $0.02 as well -- I have designed a threaded Ogg encoder
> (see http://www.mpi.nd.edu/~jsquyres/vorbis/) that would use multiple
> threads to encode a single song (slightly different than the above
> description).
> 
> But I haven't implemented it yet because last I checked, the library was
> *not* thread safe, and Bad Things happened when I wrote up a trivial
> multi-threaded encoder.  Last I heard, making it thread safe was "on the
> list".  Has any progress been made in this area?

Thread safety is almost never a yes/no issue (Sun wrote a great short
essay proposing five or six level of thread safety and the official
terms to go with them); all 'thread-safe' libraries have restrictions
of one sort or another (even if the restrictions are hidden with
locking) and libogg/libvorbis/libvorbisfile/libvorbisenc are no
exception.  Within these restrictions, the libs are thread safe.

Right now, the restriction is that any given data structure (ogg_* or
vorbis_* or OggVorbis_File) can be referenced by only one thread at a
time.  There's an additional restriction that some data structures do
reference memory in the others; the arrangement is careful and stable
and I probably should document it :-) Encode is more restricted than
decode because frame analysis serialized over several frames.  That's
not escapable without disabling some chunks of encode analysis.

However, if you're decoding two seperate streams and using seperate
structures for each, you'll have no thread safety problems.

Kim: If I write an unpolished but fact-filled 'Threading and
libvorbis' guide, do you have time to polish it into something
intelligible?

Monty

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list