Reentrancy and DB-Library

DB Library for C

DB Library for C

Reentrancy and DB-Library

In applications where each thread uses a separate DBPROCESS connection, you don't need to serialize the DB-Library calls. However, you must use dbprocerrhandle (instead of dberrhandle) and dbprocmsghandle (instead of dbmsghandle) to establish connection-specific (instead of global) error and message handlers for your application. You should pass a LOGINREC to dbprocerrhandle and dbprocmsghandle before calling dbopen using that LOGINREC. If you follow these steps, DB-Library is completely reentrant and thread-safe.

DB-Library functions and routines that access a shared DBPROCESS are not reentrant across multiple threads. Therefore, be sure that you serialize all DB-Library calls that access the same DBPROCESS in multithreaded applications you develop.