The thread-safe public interface to AST is designed so that an
error is reported if any thread attempts to use an Object that it
has not previously locked for its own exclusive use using this
function. When an Object is created, it is initially locked by the
thread that creates it, so newly created objects do not need to be
explicitly locked. However, if an Object pointer is passed to
another thread, the original thread must first unlock it (using
astUnlock) and the new thread must then lock it (using astLock)
before the new thread can use the Object.
The "wait" parameter determines what happens if the supplied Object
is curently locked by another thread when this function is invoked.