On Aug 18, 2009, at 5:20 AM, masarati@aero.polimi.it wrote:
The code is littered with tests like #ifdef HAVE_GMTIME_R, but there's no longer tests for gmtime_r() in configure. Is it time to cleanup a bit?
p.
I note that OpenLDAP Software uses a single configure script to generate configuration information used for building both thread-aware and thread-unaware programs and libraries. Hence, special care must be taken the generated configuration information is valid for both purposes. In some cases, it's easier just to avoid the differences (such as by using (or not) certain system interfaces).
It likely would be better to have two (thread-aware/thread-unaware) or three (common/thread-aware/thread-unaware) configure scripts.
I'm inclined towards defining a private function, with an interface analogous to that of the tread-safe function, and use it all times, re-entrant as appropriate. If the re-entrant function is available, a #define could be used instead. Otherwise, the wrapper would take care of the rest. This would solve the issue once for all, and clean up quite a bit the code, as any mutex would no longer need to be exposed.
p.