Define thread-safe variables (UNIX™)
When you specify the -thread command-line option to esql, the Informix® ESQL/C preprocessor passes the IFX_THREAD definition to the C compiler. The IFX_THREAD definition tells the C compiler to create thread-scoped variables for variables that are global in non-thread-safe Informix® ESQL/C code.
For example, when the C compiler includes the sqlca.h file with IFX_THREAD set, it defines thread-scoped variables for the Informix® ESQL/C status variables: SQLCODE, SQLSTATE, and the sqlca structure. The thread-scoped versions of status variables are macros that map the global status variables to thread-safe function calls that obtain thread-specific status information.
The following figure shows
an excerpt from the sqlca.h file with the thread-scoped
definitions for Informix®
ESQL/C status
variables.