ctSetOWNER
Allows a thread to take ownership of an existing c-tree connection.
Declaration
VOID ctSetOWNER(NINT sOWNR)
Description
ctSetOWNER() allows a thread to take ownership of an existing c-tree connection. This is useful in applications where one thread needs to perform some duty in another thread of operation. For example, a controller thread taking over a worker thread for administrative tasks.
Note: This function is only available in the c-tree multi-threaded library.
Return
void
Example
A thread can use this function to take ownership of a c-tree connection as demonstrated by the following:
NINT sOWNR = 0; /* A c-tree connection handle accessible to both threads. */
Thread #1:
/* Initialize c-tree. */
INTISAM(...);
/* Get handle for this connection. */
sOWNR = ctOWNER();
Thread #2:
/* Take ownership of the connection. */
ctSetOWNER(sOWNR);
/* Call c-tree functions on the connection from Thread #1. */
Only a single thread is expected to make c-tree API calls using a particular owner. In the above case, thread #1 still has the same OWNER value. Undefined behavior occurs if multiple threads make c-tree API calls using the same connection.