summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-02-09 10:39:35 +0000
committerIvan Zhakov <ivan@apache.org>2022-02-09 10:39:35 +0000
commit0ef545062eda29eb0db5f49e11ca4fec3e038529 (patch)
tree7e8a150c4e114f40c21af7dc5a9cb04a7033e9d4 /include
parent011f944967c77b5608eaebf4cdc1947b7340d804 (diff)
parent89682a8e2e5eb498b6c4e4ff162052c7e2406a0b (diff)
downloadapr-0ef545062eda29eb0db5f49e11ca4fec3e038529.tar.gz
On 'win32-pollset-wakeup-no-file-socket-emulation' branch: Merge changes fromwin32-pollset-wakeup-no-file-socket-emulation
trunk. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897894 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/apr_poll.h1
-rw-r--r--include/apr_thread_proc.h49
2 files changed, 49 insertions, 1 deletions
diff --git a/include/apr_poll.h b/include/apr_poll.h
index 482d6ee1d..3cfbfc810 100644
--- a/include/apr_poll.h
+++ b/include/apr_poll.h
@@ -52,6 +52,7 @@ extern "C" {
#define APR_POLLERR 0x010 /**< Pending error */
#define APR_POLLHUP 0x020 /**< Hangup occurred */
#define APR_POLLNVAL 0x040 /**< Descriptor invalid */
+#define APR_POLLEXCL 0x080 /**< Exclusive wake up */
/** @} */
/**
diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h
index b1bd01533..85f697dd2 100644
--- a/include/apr_thread_proc.h
+++ b/include/apr_thread_proc.h
@@ -212,6 +212,25 @@ typedef enum {
#if APR_HAS_THREADS
/**
+ * APR_THREAD_LOCAL keyword mapping the compiler's.
+ */
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#define APR_THREAD_LOCAL thread_local
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112
+#define APR_THREAD_LOCAL _Thread_local
+#elif defined(__GNUC__) /* works for clang too */
+#define APR_THREAD_LOCAL __thread
+#elif defined(WIN32) && defined(_MSC_VER)
+#define APR_THREAD_LOCAL __declspec(thread)
+#endif
+
+#ifdef APR_THREAD_LOCAL
+#define APR_HAS_THREAD_LOCAL 1
+#else
+#define APR_HAS_THREAD_LOCAL 0
+#endif
+
+/**
* Create and initialize a new threadattr variable
* @param new_attr The newly created threadattr.
* @param cont The pool to use
@@ -270,6 +289,30 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new_thread,
void *data, apr_pool_t *cont);
/**
+ * Setup the current native thread as an apr_thread
+ * @param current The current apr_thread set up (or reused)
+ * @param attr The threadattr associated with the current thread
+ * @param pool The parent pool of the current thread
+ * @return APR_SUCCESS, APR_EEXIST if the current thread is already set,
+ * any error otherwise
+ */
+APR_DECLARE(apr_status_t) apr_thread_current_create(apr_thread_t **current,
+ apr_threadattr_t *attr,
+ apr_pool_t *pool);
+
+/**
+ * Clear the current thread after fork()
+ */
+APR_DECLARE(void) apr_thread_current_after_fork(void);
+
+/**
+ * Get the current thread
+ * @param The current apr_thread, NULL if it is not an apr_thread or if
+ * it could not be determined.
+ */
+APR_DECLARE(apr_thread_t *) apr_thread_current(void);
+
+/**
* Stop the current thread
* @param thd The thread to stop
* @param retval The return value to pass back to any thread that cares
@@ -389,7 +432,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