astLock

Lock an Object for exclusive use by the calling thread

Description:

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.

Synopsis

void astLock( AstObject this, int wait )

Parameters:

this
Pointer to the Object to be locked.
wait
If the Object is curently locked by another thread then this function will either report an error or block. If a non-zero value is supplied for " wait" , the calling thread waits until the object is available for it to use. Otherwise, an error is reported and the function returns immediately without locking the Object.

Applicability

Object
This function applies to all Objects.

Notes: