diff options
author | minfrin <minfrin@13f79535-47bb-0310-9956-ffa450edef68> | 2011-12-06 01:08:40 +0000 |
---|---|---|
committer | minfrin <minfrin@13f79535-47bb-0310-9956-ffa450edef68> | 2011-12-06 01:08:40 +0000 |
commit | aca4351e2f768674a4a6928e634406e7385226d9 (patch) | |
tree | 45ba98a0f5e105e8c62181d11c7f5497c422972a /misc/apr_queue.c | |
parent | c83b477521ed2aaf40c6a47d540c665ca9bd539c (diff) | |
parent | 796db2a03ab94945939e0e91c269a611463d43a8 (diff) | |
download | libapr-util-1.4.0.tar.gz |
Tag v1.4.0.1.4.0
git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/tags/1.4.0@1210733 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc/apr_queue.c')
-rw-r--r-- | misc/apr_queue.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/misc/apr_queue.c b/misc/apr_queue.c index b74fdf85..82859c84 100644 --- a/misc/apr_queue.c +++ b/misc/apr_queue.c @@ -185,7 +185,9 @@ APU_DECLARE(apr_status_t) apr_queue_push(apr_queue_t *queue, void *data) } queue->data[queue->in] = data; - queue->in = (queue->in + 1) % queue->bounds; + queue->in++; + if (queue->in >= queue->bounds) + queue->in -= queue->bounds; queue->nelts++; if (queue->empty_waiters) { @@ -225,7 +227,9 @@ APU_DECLARE(apr_status_t) apr_queue_trypush(apr_queue_t *queue, void *data) } queue->data[queue->in] = data; - queue->in = (queue->in + 1) % queue->bounds; + queue->in++; + if (queue->in >= queue->bounds) + queue->in -= queue->bounds; queue->nelts++; if (queue->empty_waiters) { @@ -297,7 +301,9 @@ APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void **data) *data = queue->data[queue->out]; queue->nelts--; - queue->out = (queue->out + 1) % queue->bounds; + queue->out++; + if (queue->out >= queue->bounds) + queue->out -= queue->bounds; if (queue->full_waiters) { Q_DBG("signal !full", queue); rv = apr_thread_cond_signal(queue->not_full); @@ -337,7 +343,9 @@ APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void **data) *data = queue->data[queue->out]; queue->nelts--; - queue->out = (queue->out + 1) % queue->bounds; + queue->out++; + if (queue->out >= queue->bounds) + queue->out -= queue->bounds; if (queue->full_waiters) { Q_DBG("signal !full", queue); rv = apr_thread_cond_signal(queue->not_full); |