Create thread-safe ESQL/C applications
Informix® ESQL/C provides shared and static thread-safe and shared and static default versions of the Informix® general libraries on both UNIX™ and Windows™ operating systems. On Windows™ operating systems, Informix® ESQL/C provides a dll named isqlt09a.dll and a static thread-safe library named isqlt09s.lib.
A thread-safe Informix® ESQL/C application can have one active connection per thread and many threads per application. The thread-safe libraries contain thread-safe (or reentrant) functions. A thread-safe function is one that behaves correctly when several threads call it simultaneously.
For the Informix® ESQL/C on a UNIX™ operating system, the thread-safe Informix® general libraries use functions from the Distributed Computing Environment (DCE) thread package. The DCE thread library, which the Open Software Foundation (OSF) developed, creates a standard interface for thread-safe applications.
If the DCE thread library is not available on your operating system, ESQL/C can use POSIX thread libraries or Sun Solaris thread libraries.
If your operating system supports the DCE, POSIX, or Solaris thread packages, you must install them on the same client computer as ESQL/C.
In Windows™ environments, the Informix® general libraries use the Windows™ API to ensure that they are thread safe.
With the thread-safe Informix® general libraries, you can develop thread-safe Informix® ESQL/C applications. A thread-safe application can have many threads of control. It separates a process into multiple execution threads, each of which runs independently. While a non-threaded Informix® ESQL/C application can establish many connections to one or more databases, it can have only one active connection at a time. An active connection is one that is ready to process SQL requests. A thread-safe Informix® ESQL/C application can have one active connection per thread and many threads per application.
When you specify the -thread command-line option, the esql command passes this option to the Informix® ESQL/C preprocessor, esqlc. With the -thread option, the Informix® ESQL/C preprocessor generates thread-safe code that different threads can execute concurrently.