INF: Using SQL Db-Lib Calls in Multithreaded Programming

ID: Q66472


The information in this article applies to:


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.


MORE INFORMATION

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 query words: dblib


Keywords          : kbprg SSrvDB_Lib 
Version           : 4.2
Platform          : OS/2 
Issue type        : 

Last Reviewed: March 10, 1999