summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2022-01-25 10:53:28 +0000
committerylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2022-01-25 10:53:28 +0000
commit9574bc0c0ed012f77263a1cf719e38dcbb697979 (patch)
tree4b53bdc1e48f97e277ccbaf1fd8461150cfa4eba
parent9743a87cfb23e720a49f519a5882bdd4bed7b87b (diff)
downloadlibapr-9574bc0c0ed012f77263a1cf719e38dcbb697979.tar.gz
apr_thread: Follow up to r1897207: Make APR_HAS_THREAD_LOCAL a boolean..
.. rather than a defined(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897447 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 ab1e1a92d..270cb24b2 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 faa255b63..25bd0d2bb 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
@@ -178,7 +178,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;
@@ -186,7 +186,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 a160cb71d..40b6d7259 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
@@ -213,7 +213,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;
@@ -221,7 +221,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 3c590a6dc..d23be9aed 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
@@ -181,7 +181,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;
@@ -189,7 +189,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 6d1874ac8..d3eac6509 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
@@ -254,7 +254,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;
@@ -262,7 +262,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 ee2070bc8..c4fd81fff 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
@@ -193,7 +193,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;
@@ -201,7 +201,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;
@@ -215,7 +215,7 @@ APR_DECLARE(void) apr_thread_exit(apr_thread_t *thd, apr_status_t retval)
if (!thd->td) { /* detached? */
apr_pool_destroy(thd->pool);
}
-#ifdef APR_HAS_THREAD_LOCAL
+#if APR_HAS_THREAD_LOCAL
current_thread = NULL;
#endif
_endthreadex(0);