INF: Using SQL Db-lib Calls in Multithreaded Programming

ID Number: Q66472

1.00 1.10 4.20

OS/2

Summary:

The DB-LIBRARY (db-lib) routines are basically non-reentrant;

therefore, you are responsible for serializing the db-lib calls that

access the named pipe connection in multithreaded applications you

develop.

This is true when more than one thread accesses a single dbprocess; it

is necessary to serialize calls to the named pipe connection in an

application where more than one thread accesses a single dbprocess.

Also, if each thread accesses a different dbprocess, you are freed of

serialization concerns except for operations that involve global

variables. Error and message handling is maintained globally;

therefore, you might want to block on a semaphore when an error or

message occurs, so that you are not preempted by another thread. The

dbprocess passed to the error/message handler will distinguish which

thread is involved.

Timeouts are also managed globally.

Additional reference words: 1.10 1.11 4.20 dblib