summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2003-12-29 15:06:38 +0000
committerJoe Orton <jorton@apache.org>2003-12-29 15:06:38 +0000
commit55b1bb62feddca16d6f31234d3d3478a759f10fc (patch)
tree2909a16375125ea76e58caf749b92975156af4c0
parent438cd0fd68fa89b4d2db93e1bd416c5ecca18fab (diff)
downloadapr-55b1bb62feddca16d6f31234d3d3478a759f10fc.tar.gz
* include/arch/unix/apr_arch_thread_cond.h: Store a pthread_cond_t
object in struct apr_thread_cond_t rather than a pointer to one. * locks/unix/thread_cond.c (apr_thread_cond_create): Adjust use of ->cond, remove ENOMEM handling. (apr_thread_cond_wait, apr_thread_cond_timedwait, apr_thread_cond_signal, apr_thread_cond_broadcast): Adjust use of ->cond. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64847 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/arch/unix/apr_arch_thread_cond.h2
-rw-r--r--locks/unix/thread_cond.c25
2 files changed, 8 insertions, 19 deletions
diff --git a/include/arch/unix/apr_arch_thread_cond.h b/include/arch/unix/apr_arch_thread_cond.h
index ce4f3ce9c..5ae50d1ee 100644
--- a/include/arch/unix/apr_arch_thread_cond.h
+++ b/include/arch/unix/apr_arch_thread_cond.h
@@ -72,7 +72,7 @@
#if APR_HAS_THREADS
struct apr_thread_cond_t {
apr_pool_t *pool;
- pthread_cond_t *cond;
+ pthread_cond_t cond;
};
#endif
diff --git a/locks/unix/thread_cond.c b/locks/unix/thread_cond.c
index a09ec3fc7..ae6c760cf 100644
--- a/locks/unix/thread_cond.c
+++ b/locks/unix/thread_cond.c
@@ -64,7 +64,7 @@ static apr_status_t thread_cond_cleanup(void *data)
apr_thread_cond_t *cond = (apr_thread_cond_t *)data;
apr_status_t rv;
- rv = pthread_cond_destroy(cond->cond);
+ rv = pthread_cond_destroy(&cond->cond);
#ifdef PTHREAD_SETS_ERRNO
if (rv) {
rv = errno;
@@ -79,22 +79,11 @@ APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond,
apr_thread_cond_t *new_cond;
apr_status_t rv;
- new_cond = (apr_thread_cond_t *)apr_pcalloc(pool,
- sizeof(apr_thread_cond_t));
-
- if (new_cond == NULL) {
- return APR_ENOMEM;
- }
+ new_cond = apr_palloc(pool, sizeof(apr_thread_cond_t));
new_cond->pool = pool;
- new_cond->cond = (pthread_cond_t *)apr_palloc(pool,
- sizeof(pthread_cond_t));
-
- if (new_cond->cond == NULL) {
- return APR_ENOMEM;
- }
- if ((rv = pthread_cond_init(new_cond->cond, NULL))) {
+ if ((rv = pthread_cond_init(&new_cond->cond, NULL))) {
#ifdef PTHREAD_SETS_ERRNO
rv = errno;
#endif
@@ -115,7 +104,7 @@ APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond,
{
apr_status_t rv;
- rv = pthread_cond_wait(cond->cond, &mutex->mutex);
+ rv = pthread_cond_wait(&cond->cond, &mutex->mutex);
#ifdef PTHREAD_SETS_ERRNO
if (rv) {
rv = errno;
@@ -136,7 +125,7 @@ APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond,
abstime.tv_sec = apr_time_sec(then);
abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */
- rv = pthread_cond_timedwait(cond->cond, &mutex->mutex, &abstime);
+ rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime);
#ifdef PTHREAD_SETS_ERRNO
if (rv) {
rv = errno;
@@ -153,7 +142,7 @@ APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond)
{
apr_status_t rv;
- rv = pthread_cond_signal(cond->cond);
+ rv = pthread_cond_signal(&cond->cond);
#ifdef PTHREAD_SETS_ERRNO
if (rv) {
rv = errno;
@@ -166,7 +155,7 @@ APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond)
{
apr_status_t rv;
- rv = pthread_cond_broadcast(cond->cond);
+ rv = pthread_cond_broadcast(&cond->cond);
#ifdef PTHREAD_SETS_ERRNO
if (rv) {
rv = errno;