summaryrefslogtreecommitdiff
path: root/threadproc/beos/thread.c
diff options
context:
space:
mode:
authordreid <dreid@13f79535-47bb-0310-9956-ffa450edef68>2001-10-29 17:29:32 +0000
committerdreid <dreid@13f79535-47bb-0310-9956-ffa450edef68>2001-10-29 17:29:32 +0000
commit78ad0ab0e5b39ea3dd92560a5c38bd10ad19b399 (patch)
tree36740c42f62b2c0d00f3072b136237577778a8d3 /threadproc/beos/thread.c
parent50dcee6c40b360eb96bb901de3e6381f66b225da (diff)
downloadlibapr-78ad0ab0e5b39ea3dd92560a5c38bd10ad19b399.tar.gz
BeOS threads can exit in strange orders, even in testthread they will often
exit in an order different from that they were started in, so store the thread exitval and if we miss the death of a thread when calling thread_join we return the stored value. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62474 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/beos/thread.c')
-rw-r--r--threadproc/beos/thread.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/threadproc/beos/thread.c b/threadproc/beos/thread.c
index ec9327e86..c5b69a968 100644
--- a/threadproc/beos/thread.c
+++ b/threadproc/beos/thread.c
@@ -109,6 +109,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t
(*new)->cntxt = pool;
(*new)->data = data;
(*new)->func = func;
+ (*new)->exitval = -1;
/* First we create the new thread...*/
if (attr)
@@ -144,6 +145,7 @@ int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2)
APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t *retval)
{
apr_pool_destroy(thd->cntxt);
+ thd->exitval = *retval;
exit_thread ((status_t)(*retval));
/* This will never be reached... */
return APR_SUCCESS;
@@ -157,7 +159,14 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *th
return APR_SUCCESS;
}
else {
- return ret;
+ /* if we've missed the thread's death, did we set an exit value prior
+ * to it's demise? If we did return that.
+ */
+ if (thd->exitval != -1) {
+ *retval = thd->exitval;
+ return APR_SUCCESS;
+ } else
+ return ret;
}
}