diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2002-11-25 05:06:31 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2002-11-25 05:06:31 +0000 |
commit | e03f60f74126bdc791a517dd4be3784f7ba123c4 (patch) | |
tree | b1cb5f9f325fe1ca38da3591c23a7ab31fc0c6f2 /threadproc | |
parent | f1a24cb946b343f6bbe84aea815670c40d3223b7 (diff) | |
download | libapr-e03f60f74126bdc791a517dd4be3784f7ba123c4.tar.gz |
As pointed out by Marcel Mann <Marcel.Mann@dbaudio.com>, we were
returning 0xfffffffe (the pseudo-handle) for the current thread.
Stash the real apr_thread_t and recover it for apr_os_thread_current().
We were also missing thread_compare so I dropped that in while I was
at it. The test is simple with the above behavior.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64085 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r-- | threadproc/win32/thread.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c index f602c96a3..12c6f2576 100644 --- a/threadproc/win32/thread.c +++ b/threadproc/win32/thread.c @@ -63,6 +63,9 @@ #endif #include "misc.h" +/* Chosen for us in apr_initialize */ +DWORD tls_apr_thread = 0; + APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool) { @@ -94,6 +97,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr) static void *dummy_worker(void *opaque) { apr_thread_t *thd = (apr_thread_t *)opaque; + TlsSetValue(tls_apr_thread, thd); return thd->func(thd, thd->data); } @@ -214,7 +218,8 @@ APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key, APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void) { - return GetCurrentThread(); + apr_thread_t *thd = (apr_thread_t *)TlsGetValue(tls_apr_thread); + return thd->td; } APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, @@ -258,4 +263,14 @@ APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, return APR_SUCCESS; } +APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1, + apr_os_thread_t tid2) +{ + /* Since the only tid's we support our are own, and + * apr_os_thread_current returns the identical handle + * to the one we created initially, the test is simple. + */ + return (tid1 == tid2); +} + APR_POOL_IMPLEMENT_ACCESSOR(thread) |