diff options
author | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 1999-10-19 19:21:22 +0000 |
---|---|---|
committer | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 1999-10-19 19:21:22 +0000 |
commit | d4524e0683ab5df3020443ce64daefcf90fff7ab (patch) | |
tree | 12c346c6118d95914867bf6df2aacb555f1b8121 /time | |
parent | 6554acacd2200568e05dcbcbd50072ed8c60409d (diff) | |
download | libapr-d4524e0683ab5df3020443ce64daefcf90fff7ab.tar.gz |
Remove all of the ugly SAFETY_LOCK code. APR determines if it has threading
support turned on. If so, it uses re-entrant functions that should be there.
If the functions aren't there, we use non-re-entrant functions. If this
causes problems in the future, we'll provide implementations of the
re-entrant functions. For now though, this should work, and it is definately
cleaner than what we had before.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59383 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'time')
-rw-r--r-- | time/unix/time.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/time/unix/time.c b/time/unix/time.c index 4400916d8..7902555f3 100644 --- a/time/unix/time.c +++ b/time/unix/time.c @@ -58,16 +58,10 @@ #include "apr_general.h" #include "apr_lib.h" #include "apr_portable.h" -#include "apr_macro.h" #include <time.h> #include <errno.h> #include <string.h> -#ifndef _POSIX_THREAD_SAFE_FUNCTIONS -static ap_lock_t *lock_time = NULL; -#endif - - /* ***APRDOC******************************************************** * ap_status_t ap_make_time(ap_context_t *, ap_time_t *) * Create a time entity. @@ -113,15 +107,19 @@ ap_status_t ap_explode_time(struct atime_t *atime, ap_timetype_e type) { switch (type) { case APR_LOCALTIME: { - SAFETY_LOCK(time, "timefile"); - LOCALTIME_R(&atime->currtime->tv_sec, atime->explodedtime); - SAFETY_UNLOCK(time); +#if APR_HAS_THREADS && _POSIX_THREAD_SAFE_FUNCTIONS + localtime_r(&atime->currtime->tv_sec, atime->explodedtime); +#else + atime->explodedtime = localtime(&atime->currtime->tv_sec); +#endif break; } case APR_UTCTIME: { - SAFETY_LOCK(time, "timefile"); - GMTIME_R(&atime->currtime->tv_sec, atime->explodedtime); - SAFETY_UNLOCK(time); +#if APR_HAS_THREADS && _POSIX_THREAD_SAFE_FUNCTIONS + gmtime_r(&atime->currtime->tv_sec, atime->explodedtime); +#else + atime->explodedtime = gmtime(&atime->currtime->tv_sec); +#endif break; } } |