summaryrefslogtreecommitdiff
path: root/threadproc/beos/thread.c
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2001-07-24 05:16:32 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2001-07-24 05:16:32 +0000
commit7d62829cc30e878f69fe08859da87edf45dfc99e (patch)
tree26ea8dc8170ce3aa804d7c1a26bf85428121e009 /threadproc/beos/thread.c
parent710d17631334f9a795ff71a5c41090b19067245d (diff)
downloadlibapr-7d62829cc30e878f69fe08859da87edf45dfc99e.tar.gz
Updated APR to pass the thread worker_function prototype
(apr_thread_start_t) two parameters, the apr private data (apr_thread_t*) and the application private data (void*). Applications' worker_thread() routines may use apr_thread_pool_get to access the pool (implemented using APR_POOL_*_ACCESSOR() macros.) Submitted by: Aaron Bannert <aaron@ebuilt.com> Reviewed by: Will Rowe git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61998 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/beos/thread.c')
-rw-r--r--threadproc/beos/thread.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/threadproc/beos/thread.c b/threadproc/beos/thread.c
index 6bec7de62..51838973b 100644
--- a/threadproc/beos/thread.c
+++ b/threadproc/beos/thread.c
@@ -88,6 +88,12 @@ apr_status_t apr_threadattr_detach_get(apr_threadattr_t *attr)
return APR_NOTDETACH;
}
+void *dummy_worker(void *opaque)
+{
+ apr_thread_t *thd = (apr_thread_t*)opaque;
+ return thd->func(thd, thd->data);
+}
+
apr_status_t apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr,
apr_thread_start_t func, void *data,
apr_pool_t *cont)
@@ -101,6 +107,8 @@ apr_status_t apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr,
}
(*new)->cntxt = cont;
+ (*new)->data = data;
+ (*new)->func = func;
/* First we create the new thread...*/
if (attr)
@@ -113,7 +121,7 @@ apr_status_t apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr,
return stat;
}
- (*new)->td = spawn_thread((thread_func)func, "apr thread", temp, data);
+ (*new)->td = spawn_thread((thread_func)dummy_func, "apr thread", temp, (*new));
/* Now we try to run it...*/
if (resume_thread((*new)->td) == B_NO_ERROR) {
return APR_SUCCESS;
@@ -191,3 +199,5 @@ apr_status_t apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd,
(*thd)->td = *thethd;
return APR_SUCCESS;
}
+
+APR_POOL_IMPLEMENT_ACCESSOR_X(thread, cntxt)