You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2022/01/25 10:53:28 UTC
svn commit: r1897447 - in /apr/apr/trunk: include/apr_thread_proc.h threadproc/beos/thread.c threadproc/netware/thread.c threadproc/os2/thread.c threadproc/unix/thread.c threadproc/win32/thread.c
Author: ylavic
Date: Tue Jan 25 10:53:28 2022
New Revision: 1897447
URL: http://svn.apache.org/viewvc?rev=1897447&view=rev
Log:
apr_thread: Follow up to r1897207: Make APR_HAS_THREAD_LOCAL a boolean..
.. rather than a defined().
Modified:
apr/apr/trunk/include/apr_thread_proc.h
apr/apr/trunk/threadproc/beos/thread.c
apr/apr/trunk/threadproc/netware/thread.c
apr/apr/trunk/threadproc/os2/thread.c
apr/apr/trunk/threadproc/unix/thread.c
apr/apr/trunk/threadproc/win32/thread.c
Modified: apr/apr/trunk/include/apr_thread_proc.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_thread_proc.h?rev=1897447&r1=1897446&r2=1897447&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_thread_proc.h (original)
+++ apr/apr/trunk/include/apr_thread_proc.h Tue Jan 25 10:53:28 2022
@@ -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_
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
Modified: apr/apr/trunk/threadproc/beos/thread.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/beos/thread.c?rev=1897447&r1=1897446&r2=1897447&view=diff
==============================================================================
--- apr/apr/trunk/threadproc/beos/thread.c (original)
+++ apr/apr/trunk/threadproc/beos/thread.c Tue Jan 25 10:53:28 2022
@@ -62,7 +62,7 @@ APR_DECLARE(apr_status_t) apr_threadattr
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_cur
(*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_cur
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;
Modified: apr/apr/trunk/threadproc/netware/thread.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/netware/thread.c?rev=1897447&r1=1897446&r2=1897447&view=diff
==============================================================================
--- apr/apr/trunk/threadproc/netware/thread.c (original)
+++ apr/apr/trunk/threadproc/netware/thread.c Tue Jan 25 10:53:28 2022
@@ -64,7 +64,7 @@ APR_DECLARE(apr_status_t) apr_threadattr
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_cur
(*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_cur
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;
Modified: apr/apr/trunk/threadproc/os2/thread.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/os2/thread.c?rev=1897447&r1=1897446&r2=1897447&view=diff
==============================================================================
--- apr/apr/trunk/threadproc/os2/thread.c (original)
+++ apr/apr/trunk/threadproc/os2/thread.c Tue Jan 25 10:53:28 2022
@@ -68,13 +68,13 @@ APR_DECLARE(apr_status_t) apr_threadattr
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_cur
(*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_cur
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;
Modified: apr/apr/trunk/threadproc/unix/thread.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/unix/thread.c?rev=1897447&r1=1897446&r2=1897447&view=diff
==============================================================================
--- apr/apr/trunk/threadproc/unix/thread.c (original)
+++ apr/apr/trunk/threadproc/unix/thread.c Tue Jan 25 10:53:28 2022
@@ -136,7 +136,7 @@ APR_DECLARE(apr_status_t) apr_threadattr
#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_cur
*(*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_cur
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;
Modified: apr/apr/trunk/threadproc/win32/thread.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/win32/thread.c?rev=1897447&r1=1897446&r2=1897447&view=diff
==============================================================================
--- apr/apr/trunk/threadproc/win32/thread.c (original)
+++ apr/apr/trunk/threadproc/win32/thread.c Tue Jan 25 10:53:28 2022
@@ -72,7 +72,7 @@ APR_DECLARE(apr_status_t) apr_threadattr
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_cur
(*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_cur
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_th
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);