Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Thread API Details

This Section provides details on the functions making up the FairCom Threading API. Note the following points:

  • ctThrdInit() must be called before any FairCom DB API calls, including initialization.
  • FairCom DB must be initialized in each thread individually, and only in threads created with ctThrdCreate() or attached with ctThrdAttach().
  • The ctThrd API and the Instance API (RegisterCtree(), etc.) are not compatible in Multithreaded Standalone model. Each thread should contain exactly one instance of FairCom DB. This is not an issue with the Multithreaded Client model.
  • Functions specifying a time interval may use ctNOWAIT to indicate a zero interval and ctWAITFOREVER to indicate an indefinite interval.
  • Unless stated otherwise, a return of zero indicates success. uerr_cod is not set by these functions, however sysiocod is set when unexpected threading errors occur.
  • To override the default stack size defined in ctatrd.h, add the following code to ctoptn.h, FairCom DB Option Header, or your application before any FairCom DB headers are included. If adding to ctoptn.h, recall that ctoptn.h is dynamically created during execution of the make file created by m-tree, ctree.mak. If changes are to be made to ctoptn.h, be sure the changes are made to the ctoptn.h creation logic at the end of the make file ctree.mak.

#define ctAppSTACKSIZE stack_size

The following error codes are particularly relevant to the threading API:

Value

Symbolic Constant

Explanation

90

NQUE_ERR

Queue ID out of range.

92

QMRT_ERR

Queue memory error during write.

95

STSK_ERR

Could not start thread.

129

NINT_ERR

FairCom DB not initialized.

156

NTIM_ERR

Timeout occurred.

514

CQUE_ERR

Queue has been closed.

635

TSYC_ERR

Could not create thread synchronization object.

636

TSYF_ERR

Thread sync object Get failed.

637

TSYR_ERR

Thread sync object Rel(ease) failed.

638

TQUE_ERR

Queue message truncated to fit buflen

639

TZRO_ERR

Semaphore must be initialized with count > 0.

640

TINT_ERR

Semaphore already initialized.

641

TSYX_ERR

Thread sync object close failed.

TOCIndex