|
From: Andreas E. <ae...@op...> - 2008-11-25 12:03:22
|
Markus Hoenicka wrote: > Quoting Artyom <art...@ya...>: > >> 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. > Not necessarily. You can advertise certain interfaces as thread-safe while making no such statement of other interfaces. For example, it doesn't make sense to have certain init functions thread-safe, because they might be designed to run once and once only during the apps' lifetime. > >> 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). > In all likelihood, those platforms will be the ones with decent thread- support to begin with, so it should be a reasonably safe bet that apps on such platforms will either not be multi-threaded anyway, or that it's relatively straightforward to use reentrant functions in libdbi there. -- Andreas Ericsson and...@op... OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 |