Quoting Artyom <[EMAIL PROTECTED]>: > 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. >
This is perfectly reasonable. However, if we advertise libdbi as thread-safe, we must also accommodate programmers who use one instance per thread, for whatever reason. > gmtime_r, readdir_r exists on both Linux and Cygwin platforms and > according to man mages exists in FreeBSD as well: > Yes, I've mentioned those as I do have access to them and positively know they support the reentrant versions. I'm more concerned about the systems that I don't run myself, like OSX, the other *BSDs, Solaris and so on. > However readdir_r is less important because it is quite reasonable > to load shared objects from single thread. > Once again, it is reasonable, but we must not rely on users doing only things that we assume as reasonable. > 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. > It is called whenever a platform does not implement timegm. We've had at least one such platform, otherwise there wouldn't be a workaround. There is another function in dbi_result.c which uses gmtime: dbi_result_get_as_string_copy_idx(). This needs to be fixed too. > Is there other points where non reenterable functions are used? To the best of my knowledge, not in libdbi. > > 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. > This is a good excuse to make libdbi 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? > I'll start reviewing the drivers as soon as time permits. We may end up labelling individual drivers as thread-safe if we can't get all of them fixed. We may also end up claiming thread-safety only for a subset of platforms (i.e. those which implement reentrant versions of functions which we cannot do without). regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ libdbi-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libdbi-devel

