|
From: Artyom <art...@ya...> - 2008-11-25 10:00:20
|
Hello, > there yet. Some of the recent changes (available in CVS > only) include > "instances" which allow threads to use the > library independently of > each other. This feature was critical for applications that > load and > unload modules which in turn are linked against libdbi. I'm mostly interested in accessing different dbi_conn objects from same thread in safe way. So, it is quite reasonable to call dbi_initialize from single thread and call dbi_shutdown from single thread. > However, I > recall that libdbi uses gmtime for time conversions and > readdir to > locate available drivers. I don't know whether every > supported OS has > the reentrant forms gmtime_r and readdir_r (FreeBSD, Linux, > and Cygwin > do). If they do, this would be easy to fix. gmtime_r, readdir_r exists on both Linux and Cygwin platforms and according to man mages exists in FreeBSD as well: http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=gmtime_r http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=readdir_r However readdir_r is less important because it is quite reasonable to load shared objects from single thread. Also, I had seen that gmtime used from timegm only if it is not implemented. (Undef cygwin/Linux it is implemented as GNU extension). Thus, gmttime shoudn't be called. Is there other points where non reenterable functions are used? I started to use the library for CppCMS project that naively runs in multiple threads. I assumed that the library is thread safe, however if I'm wrong it may be quite problematic for me. > I'd be glad if everyone could > have a look at > "their" driver and client library and let the > list know whether or not > it is thread-safe. > It would be great, at least it is possible to know what backends are not safe. For the record I had seen in sqlite (not sqlite3) backend usage of strtok. So it should be thread unsafe. What happens with others? Thanks, Artyom |