Previous Topic

Next Topic

ctThrdInit

Initialize thread management.

Short Name

ctThrdInit()

Type

Threading function

Declaration

NINT ctThrdInit(NINT numthreads, LONG mode, pctINIT cfg) 

Description

ctThrdInit() initializes c-tree Plus thread management. When using a multithreaded c-tree Plus library, you must call ctThrdInit() before initializing c-tree Plus.

mode is either zero or ctThrdFIXED_THREADS. In ctThrdFIXED_THREADS mode numthreads represents the fixed maximum number of threads available at one time. Otherwise, numthreads simply represents the number of threads allocated each time new threads are required.

cfg should be NULL for non-server applications. In the Bound Server Model, cfg points to a parameter block representing the c-tree Server configuration file options. If cfg is NULL, the bound c-tree Server, i.e., Custom Server, is initialized similarly to a standard c-tree Server.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful thread initialization.

82

UALC_ERR

Could not allocate memory.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

COUNT     retval2;
NINT      retval4;

if (retval4 = ctThrdInit(5, NULL, NULL)) {
    ctThrdTerm();
    return(retval4);
}
if ((retval2 = InitISAM(6, 25, 32)) {
    CloseISAM();
    return((NINT) retval2);
}
dbWork();
CloseISAM();
ctThrdTerm();
return(0)

Limitations

Required with a ctThrd library.

See also

ctThrdTerm()