[unixODBC-dev] Multithreading

Nick Gorham nick.gorham at easysoft.com
Thu Dec 6 16:34:39 GMT 2007

ethiele at donewell.de wrote:

>Hello everbody,
>unixODBC 2.2.12 does not scale when compiled threadsafe, without it
>scales fine.
>i hope it is not intendet to make threadsafe = run only in one Thread a
>  Eric
Not sure what you mean by Scale, but, you should set Threading=0 in the 
odbcinst.ini file if you have a thread save lib

from DriveManager/__handles.c

 * use just one mutex for all the lists, this avoids any issues
 * with deadlocks, the performance issue should be minimal, if it
 * turns out to be a problem, we can readdress this
 * We also have a mutex to protect the connection pooling code
 * If compiled with thread support the DM allows four different
 * thread strategies
 * Level 0 - Only the DM internal structures are protected
 * the driver is assumed to take care of it's self
 * Level 1 - The driver is protected down to the statement level
 * each statement will be protected, and the same for the connect
 * level for connect functions, note that descriptors are considered
 * equal to statements when it comes to thread protection.
 * Level 2 - The driver is protected at the connection level. only
 * one thread can be in a particular driver at one time
 * Level 3 - The driver is protected at the env level, only one thing
 * at a time.
 * By default the driver open connections with a lock level of 3,
 * this can be changed by adding the line
 * Threading = N
 * to the driver entry in odbcinst.ini, where N is the locking level
 * (0-3)

Nick Gorham
Easysoft Limited
http://www.easysoft.com, http://www.unixODBC.org

More information about the unixODBC-dev mailing list