Previous Topic

Next Topic

ctThrdDetach

Clean up the c-tree Plus compatibility created with ctThrdAttach().

Short Name

ctThrdDetach()

Type

Threading Function

Declaration

NINT ctThrdDetach(void) 

Description

If ctThrdDetach() is called for a thread made compatible by ctThrdAttach(), any memory allocated for control structures is returned.

If ctThrdDetach() is called for a thread that was not made compatible by ctThrdAttach(), ctThrdDetach() does nothing.

Calling ctThrdDetach() more than once for the same thread will have no affect.

Return

ctThrdDetach() always returns NO_ERROR. See “c-tree Plus Error Codes” in the c-tree Plus Programmer’s Reference Guide for a complete listing of valid c-tree Plus error values.

Example

 
NINT      retval4;
COUNT     retval2;

/* Assumes ctThrdInit is called in the main app thread */
NINT SampleThreadFunction( void )
{
    if (retval4 = ctThrdAttach()) {
        printf("\nError attaching thread: %d", retval4);
        return(retval4);
    }
    if (retval2 = InitISAM(3,50,32)) {
        printf("\nError initializing c-tree: %d", retval2);
        return(retval2);
    }
    dbWork();
    CloseISAM();
    ctThrdDetach();
    return(NULL);
}

See also

ctThrdInit(), ctThrdAttach()