summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2022-01-25 10:54:23 +0000
committerylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2022-01-25 10:54:23 +0000
commit7e6d7415ad10a14a3de057b250c153acf8ede055 (patch)
treed14d162dabfb1c4a128da0f5d4587a6de3fde15b
parent76e968e751cea811f9441a203ccb1106f27f5d8e (diff)
downloadlibapr-7e6d7415ad10a14a3de057b250c153acf8ede055.tar.gz
apr_thread: Follow up to r1897207: Make APR_HAS_THREAD_LOCAL a boolean..
.. rather than a defined(). Merge r1897447 from trunk. Submitted by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897448 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/apr_thread_proc.h10
-rw-r--r--threadproc/beos/thread.c8
-rw-r--r--threadproc/netware/thread.c8
-rw-r--r--threadproc/os2/thread.c8
-rw-r--r--threadproc/unix/thread.c8
-rw-r--r--threadproc/win32/thread.c10
6 files changed, 28 insertions, 24 deletions
diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h
index 20169ed4d..b6ac1f85d 100644
--- a/include/apr_thread_proc.h
+++ b/include/apr_thread_proc.h
@@ -209,8 +209,6 @@ typedef enum {
/* Thread Function definitions */
-#undef APR_HAS_THREAD_LOCAL
-
#if APR_HAS_THREADS
/**
@@ -228,6 +226,8 @@ typedef enum {
#ifdef APR_THREAD_LOCAL
#define APR_HAS_THREAD_LOCAL 1
+#else
+#define APR_HAS_THREAD_LOCAL 0
#endif
/**
@@ -426,7 +426,11 @@ APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key,
apr_status_t (*cleanup) (void *),
apr_threadkey_t *threadkey);
-#endif
+#else /* APR_HAS_THREADS */
+
+#define APR_HAS_THREAD_LOCAL 0
+
+#endif /* APR_HAS_THREADS */
/**
* Create and initialize a new procattr variable
diff --git a/threadproc/beos/thread.c b/threadproc/beos/thread.c
index 961a2b180..a2f4ef991 100644
--- a/threadproc/beos/thread.c
+++ b/threadproc/beos/thread.c
@@ -62,7 +62,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
return APR_ENOTIMPL;
}
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
static APR_THREAD_LOCAL apr_thread_t *current_thread = NULL;
#endif
@@ -71,7 +71,7 @@ static void *dummy_worker(void *opaque)
apr_thread_t *thd = (apr_thread_t*)opaque;
void *ret;
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = thd;
#endif
@@ -177,7 +177,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
(*current)->td = apr_os_thread_current();
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = *current;
#endif
return APR_SUCCESS;
@@ -185,7 +185,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
APR_DECLARE(apr_thread_t *) apr_thread_current(void)
{
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
return current_thread;
#else
return NULL;
diff --git a/threadproc/netware/thread.c b/threadproc/netware/thread.c
index ff0fce9e5..fe66b46cf 100644
--- a/threadproc/netware/thread.c
+++ b/threadproc/netware/thread.c
@@ -64,7 +64,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
return APR_ENOTIMPL;
}
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
static APR_THREAD_LOCAL apr_thread_t *current_thread = NULL;
#endif
@@ -73,7 +73,7 @@ static void *dummy_worker(void *opaque)
apr_thread_t *thd = (apr_thread_t *)opaque;
void *ret;
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = thd;
#endif
@@ -212,7 +212,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
(*current)->td = apr_os_thread_current();
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = *current;
#endif
return APR_SUCCESS;
@@ -220,7 +220,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
APR_DECLARE(apr_thread_t *) apr_thread_current(void)
{
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
return current_thread;
#else
return NULL;
diff --git a/threadproc/os2/thread.c b/threadproc/os2/thread.c
index 7defce049..99ae1d292 100644
--- a/threadproc/os2/thread.c
+++ b/threadproc/os2/thread.c
@@ -68,13 +68,13 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
return APR_ENOTIMPL;
}
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
static APR_THREAD_LOCAL apr_thread_t *current_thread = NULL;
#endif
static void dummy_worker(void *opaque)
{
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = thread;
#endif
@@ -180,7 +180,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
(*current)->tid = apr_os_thread_current();
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = *current;
#endif
return APR_SUCCESS;
@@ -188,7 +188,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
APR_DECLARE(apr_thread_t *) apr_thread_current(void)
{
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
return current_thread;
#else
return NULL;
diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c
index 3944e0879..504cbb4e9 100644
--- a/threadproc/unix/thread.c
+++ b/threadproc/unix/thread.c
@@ -136,7 +136,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
#endif
}
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
static APR_THREAD_LOCAL apr_thread_t *current_thread = NULL;
#endif
@@ -145,7 +145,7 @@ static void *dummy_worker(void *opaque)
apr_thread_t *thread = (apr_thread_t*)opaque;
void *ret;
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = thread;
#endif
@@ -253,7 +253,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
*(*current)->td = apr_os_thread_current();
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = *current;
#endif
return APR_SUCCESS;
@@ -261,7 +261,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
APR_DECLARE(apr_thread_t *) apr_thread_current(void)
{
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
return current_thread;
#else
return NULL;
diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c
index 5a7bff929..daeb28db5 100644
--- a/threadproc/win32/thread.c
+++ b/threadproc/win32/thread.c
@@ -72,7 +72,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
return APR_ENOTIMPL;
}
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
static APR_THREAD_LOCAL apr_thread_t *current_thread = NULL;
#endif
@@ -81,7 +81,7 @@ static void *dummy_worker(void *opaque)
apr_thread_t *thd = (apr_thread_t *)opaque;
void *ret;
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = thd;
#endif
@@ -203,7 +203,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
(*new)->td = apr_os_thread_current();
}
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = *current;
#endif
return APR_SUCCESS;
@@ -211,7 +211,7 @@ APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
APR_DECLARE(apr_thread_t *) apr_thread_current(void)
{
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
return current_thread;
#else
return NULL;
@@ -226,7 +226,7 @@ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
if (!thd->td) { /* detached? */
apr_pool_destroy(thd->pool);
}
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = NULL;
#endif
#ifndef _WIN32_WCE