doxml Manual Version 0.5: Thread-Safe Status

$Id: threads.html,v 1.2 1999/07/24 22:04:05 francis Exp $

The doxml API is not thread-aware (since it doesn't use anything outside of the ANSI C standard library). To use it in a multithreaded program, the following rules must be observed:

  1. No doxml_context may be used by two threads at the same time. (Since doxml_context embodies an input stream, this is pretty obvious: it wouldn't make much sense to have two threads reading from the same input stream, and interleaving their accesses.) However, it is safe for two threads to be running the parser on two different contexts at the same time.
  2. No doxml_document may be shared between threads, unless all of them treat it as read-only. (This applies to all components of the document, of course: it is probably unsafe for two threads to modify two separate atoms of the document.)

There may be exceptions to rule 2, but it's probably safest not to use them, since they may break in future versions of the API.

In some future version of the API, it may be possible to compile with thread support enabled (pthreads, probably).