diff options
author | David Reid <dreid@apache.org> | 2003-11-23 19:43:40 +0000 |
---|---|---|
committer | David Reid <dreid@apache.org> | 2003-11-23 19:43:40 +0000 |
commit | 327fa19e41991a50a15fdbcaa408683b6e1719f5 (patch) | |
tree | 8989178bf2506a72c10102b73bd368882d181222 /threadproc/beos | |
parent | 911e3446a052a88501cd2bdf47a7454d825ff76d (diff) | |
download | apr-327fa19e41991a50a15fdbcaa408683b6e1719f5.tar.gz |
Fix the apr_thread_once_init so it works and allow the thread test to not
segfault.
Some other small pieces of cleanup and reformatting to make the code easier
to read.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64790 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/beos')
-rw-r--r-- | threadproc/beos/thread.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/threadproc/beos/thread.c b/threadproc/beos/thread.c index 559233d8d..c2fb25ba5 100644 --- a/threadproc/beos/thread.c +++ b/threadproc/beos/thread.c @@ -122,7 +122,11 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t return stat; } - (*new)->td = spawn_thread((thread_func)dummy_worker, "apr thread", temp, (*new)); + (*new)->td = spawn_thread((thread_func)dummy_worker, + "apr thread", + temp, + (*new)); + /* Now we try to run it...*/ if (resume_thread((*new)->td) == B_NO_ERROR) { return APR_SUCCESS; @@ -154,7 +158,8 @@ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd) { status_t rv = 0, ret; - if ((ret = wait_for_thread(thd->td, &rv)) == B_NO_ERROR) { + ret = wait_for_thread(thd->td, &rv); + if (ret == B_NO_ERROR) { *retval = rv; return APR_SUCCESS; } @@ -235,9 +240,9 @@ APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, *control = (apr_thread_once_t *)apr_pcalloc(p, sizeof(apr_thread_once_t)); (*control)->hit = 0; /* we haven't done it yet... */ rc = ((*control)->sem = create_sem(1, "thread_once")); - if (rc != 0) { + if (rc < 0) return rc; - } + apr_pool_cleanup_register(p, control, thread_once_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } |