This patch adds the API apr_thread_yield() to the threads subsystem. This allows the caller to force a thread to yield the processor during such instances as compute bound operations. The attached file thread.c is the NetWare platform version and should be checked in to "apr/threadproc/netware/"
thanks, Brad
--- d:\tempapache\apr\include\apr_thread_proc.h Tue Jul 24 05:16:32 2001
+++ d:\projects\2.0.x\srclib\apr\include\apr_thread_proc.h Mon Jul 30
22:49:33 2001
@@ -217,6 +217,12 @@
apr_thread_t *thd);
/**
+ * force the current thread to yield the processor
+ * @deffunc apr_status_t apr_thread_yield()
+ */
+APR_DECLARE(apr_status_t) apr_thread_yield();
+
+/**
* detach a thread
* @param thd The thread to detach
* @deffunc apr_status_t apr_thread_detach(apr_thread_t *thd)
--- d:\tempapache\apr\threadproc\beos\thread.c Tue Jul 24 10:53:06 2001
+++ d:\projects\2.0.x\srclib\apr\threadproc\beos\thread.c Mon Jul 30
22:48:14 2001
@@ -168,6 +168,11 @@
}
}
+apr_status_t apr_thread_yield()
+{
+ return APR_SUCCESS;
+}
+
apr_status_t apr_thread_data_get(void **data, const char *key, apr_thread_t
*thread)
{
return apr_pool_userdata_get(data, key, thread->cntxt);
--- d:\tempapache\apr\threadproc\os2\thread.c Tue Jul 24 05:16:32 2001
+++ d:\projects\2.0.x\srclib\apr\threadproc\os2\thread.c Mon Jul 30
22:48:14 2001
@@ -190,6 +190,13 @@
+apr_status_t apr_thread_yield()
+{
+ return APR_SUCCESS;
+}
+
+
+
apr_status_t apr_os_thread_get(apr_os_thread_t **thethd, apr_thread_t *thd)
{
*thethd = &thd->tid;
--- d:\tempapache\apr\threadproc\unix\thread.c Tue Jul 24 13:47:46 2001
+++ d:\projects\2.0.x\srclib\apr\threadproc\unix\thread.c Mon Jul 30
22:48:14 2001
@@ -217,6 +217,11 @@
}
}
+apr_status_t apr_thread_yield()
+{
+ return APR_SUCCESS;
+}
+
apr_status_t apr_thread_data_get(void **data, const char *key, apr_thread_t
*thread)
{
return apr_pool_userdata_get(data, key, thread->cntxt);
--- d:\tempapache\apr\threadproc\win32\thread.c Tue Jul 24 20:20:02 2001
+++ d:\projects\2.0.x\srclib\apr\threadproc\win32\thread.c Mon Jul 30
22:48:14 2001
@@ -173,6 +173,11 @@
}
}
+APR_DECLARE(apr_status_t) apr_thread_yield()
+{
+ return APR_SUCCESS;
+}
+
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
apr_thread_t *thread)
{
thread.c
Description: Binary data
