In order to use an Object for anything useful, it must be locked for use by the running thread (either implicitly at creation or explicitly using astLock). The identity of the thread is stored in both the Object structure, and in the handle that was passed to astLock (or returned by the constructor function). Thus it is possible for a thread to have active pointers for Objects that are currently locked by another thread. In general, if such a pointer is passed to an AST function an error will be reported indicating that the Object is currently locked by another thread. The two exceptions to this is that astAnnul can be used to annull such a pointer, and this function can be used to return information about the pointer.
The other practical consequence of this is that when astEnd is called, all active pointers currently owned by the running thread (at the current context level) are annulled. This includes pointers for Objects that are currently locked by other threads.
If the "ptr" parameter is zero, then the returned value describes the Object structure itself. If "ptr" is non-zero, then the returned value describes the supplied Object pointer (i.e. handle), rather than the Object structure.
AST A Library for Handling World Coordinate Systems in Astronomy