You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2006/11/22 12:55:12 UTC

svn commit: r478137 - in /apr/apr/trunk: CHANGES include/arch/win32/apr_arch_threadproc.h misc/win32/start.c threadproc/win32/threadpriv.c

Author: wrowe
Date: Wed Nov 22 03:55:12 2006
New Revision: 478137

URL: http://svn.apache.org/viewvc?view=rev&rev=478137
Log:
Backout R434327, R437115, which...

Implement apr_threadkey_private destructors on WIN32
instead silently ignoring them.

and reviewed by wrowe, brane, jerenkrantz to need a more
comprehensive solution, e.g. Windows PE destructor entry
points, that does -not- break svn.

Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/include/arch/win32/apr_arch_threadproc.h
    apr/apr/trunk/misc/win32/start.c
    apr/apr/trunk/threadproc/win32/threadpriv.c

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?view=diff&rev=478137&r1=478136&r2=478137
==============================================================================
--- apr/apr/trunk/CHANGES (original)
+++ apr/apr/trunk/CHANGES Wed Nov 22 03:55:12 2006
@@ -25,10 +25,6 @@
   *) Fix the timeout converstion in apr_pollset with the KQueue
      backend. [Marco Molteni <mmolteni cisco.com>]
 
-  *) Implement apr_threadkey_private destructors on WIN32
-     instead silently ignoring them, so that they behave like on
-     the pthreads powered platforms. [Mladen Turk]
-
   *) Support MinGW.  [John Vandenberg, Justin Erenkrantz]
 
   *) Implement apr_thread_yield on Unix in terms of pthread_yield or

Modified: apr/apr/trunk/include/arch/win32/apr_arch_threadproc.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_arch_threadproc.h?view=diff&rev=478137&r1=478136&r2=478137
==============================================================================
--- apr/apr/trunk/include/arch/win32/apr_arch_threadproc.h (original)
+++ apr/apr/trunk/include/arch/win32/apr_arch_threadproc.h Wed Nov 22 03:55:12 2006
@@ -17,7 +17,6 @@
 #include "apr_private.h"
 #include "apr_thread_proc.h"
 #include "apr_file_io.h"
-#include "apr_hash.h"
 
 #ifndef THREAD_PROC_H
 #define THREAD_PROC_H
@@ -68,11 +67,6 @@
 struct apr_thread_once_t {
     long value;
 };
-
-#if defined(APR_DECLARE_EXPORT)
-/* Provide to win32/start.c */
-extern apr_hash_t *apr_tls_threadkeys;
-#endif
 
 #endif  /* ! THREAD_PROC_H */
 

Modified: apr/apr/trunk/misc/win32/start.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/misc/win32/start.c?view=diff&rev=478137&r1=478136&r2=478137
==============================================================================
--- apr/apr/trunk/misc/win32/start.c (original)
+++ apr/apr/trunk/misc/win32/start.c Wed Nov 22 03:55:12 2006
@@ -18,13 +18,11 @@
 #include "apr_general.h"
 #include "apr_pools.h"
 #include "apr_signal.h"
-#include "apr_hash.h"
 #include "ShellAPI.h"
 
 #include "apr_arch_misc.h"       /* for WSAHighByte / WSALowByte */
 #include "wchar.h"
 #include "apr_arch_file_io.h"
-#include "apr_arch_threadproc.h"
 #include "assert.h"
 
 /* This symbol is _private_, although it must be exported.
@@ -189,11 +187,6 @@
 
     apr_pool_tag(pool, "apr_initialize");
 
-#if defined(APR_DECLARE_EXPORT)
-    /* Initialize threadpriv table */
-    apr_tls_threadkeys = apr_hash_make(pool);
-#endif
-
     iVersionRequested = MAKEWORD(WSAHighByte, WSALowByte);
     err = WSAStartup((WORD) iVersionRequested, &wsaData);
     if (err) {
@@ -210,68 +203,12 @@
     return APR_SUCCESS;
 }
 
-#if defined(APR_DECLARE_EXPORT)
-typedef (apr_thredkey_destfn_t)(void *data);
-
-static void threadkey_terminate()
-{
-    apr_hash_index_t *hi = apr_hash_first(NULL, apr_tls_threadkeys);
-
-    for (; hi != NULL; hi = apr_hash_next(hi)) {
-        LPDWORD key;
-        apr_hash_this(hi, &key, NULL, NULL);
-        TlsFree(*key);
-    }
-}
-
-static void threadkey_detach()
-{
-    apr_hash_index_t *hi = apr_hash_first(NULL, apr_tls_threadkeys);
-
-    for (; hi != NULL; hi = apr_hash_next(hi)) {
-        apr_thredkey_destfn_t *dest = NULL;
-        LPDWORD key;
-        void *data;
-        apr_hash_this(hi, &key, NULL, (void **)&dest);
-        data = TlsGetValue(*key);
-        if (data != NULL || GetLastError() == ERROR_SUCCESS) {
-            /* NULL data is a valid TLS value if explicitly set
-             * by the TlsSetValue
-             */
-            (*dest)(data);
-        }
-    }
-}
-
-BOOL APIENTRY DllMain(HINSTANCE instance,
-                      DWORD  reason_for_call,
-                      LPVOID lpReserved)
-{
-    switch (reason_for_call) {
-        case DLL_PROCESS_ATTACH:
-        break;
-        case DLL_THREAD_ATTACH:
-        break;
-        case DLL_THREAD_DETACH:
-            threadkey_detach();
-        break;
-        case DLL_PROCESS_DETACH:
-        break;
-    }
-    return TRUE;
-}
-
-#endif /* APR_DECLARE_EXPORT */
-
 APR_DECLARE_NONSTD(void) apr_terminate(void)
 {
     initialized--;
     if (initialized) {
         return;
     }
-#if defined(APR_DECLARE_EXPORT)
-    threadkey_terminate();
-#endif
     apr_pool_terminate();
 
     WSACleanup();

Modified: apr/apr/trunk/threadproc/win32/threadpriv.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/win32/threadpriv.c?view=diff&rev=478137&r1=478136&r2=478137
==============================================================================
--- apr/apr/trunk/threadproc/win32/threadpriv.c (original)
+++ apr/apr/trunk/threadproc/win32/threadpriv.c Wed Nov 22 03:55:12 2006
@@ -16,16 +16,11 @@
 
 #include "apr_arch_threadproc.h"
 #include "apr_thread_proc.h"
-#include "apr_hash.h"
 #include "apr_general.h"
 #include "apr_lib.h"
 #include "apr_errno.h"
 #include "apr_portable.h"
 
-#if defined(APR_DECLARE_EXPORT)
-apr_hash_t *apr_tls_threadkeys = NULL;
-#endif
-
 APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
                                                     void (*dest)(void *),
                                                     apr_pool_t *pool)
@@ -38,10 +33,6 @@
     (*key)->pool = pool;
 
     if (((*key)->key = TlsAlloc()) != 0xFFFFFFFF) {
-#if defined(APR_DECLARE_EXPORT)
-        apr_hash_set(apr_tls_threadkeys, &((*key)->key),
-                     sizeof(DWORD), dest);
-#endif
         return APR_SUCCESS;
     }
     return apr_get_os_error();
@@ -68,11 +59,7 @@
 APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key)
 {
     if (TlsFree(key->key)) {
-#if defined(APR_DECLARE_EXPORT)
-        apr_hash_set(apr_tls_threadkeys, &(key->key),
-                     sizeof(DWORD), NULL);
-#endif
-        return APR_SUCCESS;
+        return APR_SUCCESS; 
     }
     return apr_get_os_error();
 }
@@ -110,5 +97,5 @@
     }
     (*key)->key = *thekey;
     return APR_SUCCESS;
-}
+}