summaryrefslogtreecommitdiffstats
path: root/test/testshmconsumer.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 04:59:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 04:59:58 +0000
commitb8d375bcb1f462d5af5d1f480b32d7b0038417f6 (patch)
tree93d48ade79cc9d5892f17ff41c33753be6bb0879 /test/testshmconsumer.c
parentAdding upstream version 1.7.2. (diff)
downloadapr-upstream.tar.xz
apr-upstream.zip
Adding upstream version 1.7.5.upstream/1.7.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--test/testshmconsumer.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/test/testshmconsumer.c b/test/testshmconsumer.c
index 6a2a3c3..bf70e72 100644
--- a/test/testshmconsumer.c
+++ b/test/testshmconsumer.c
@@ -30,25 +30,6 @@
#if APR_HAS_SHARED_MEMORY
-static int msgwait(int sleep_sec, int first_box, int last_box)
-{
- int i;
- int recvd = 0;
- apr_time_t start = apr_time_now();
- apr_interval_time_t sleep_duration = apr_time_from_sec(sleep_sec);
- while (apr_time_now() - start < sleep_duration) {
- for (i = first_box; i < last_box; i++) {
- if (boxes[i].msgavail && !strcmp(boxes[i].msg, MSG)) {
- recvd++;
- boxes[i].msgavail = 0; /* reset back to 0 */
- memset(boxes[i].msg, 0, 1024);
- }
- }
- apr_sleep(apr_time_from_sec(1));
- }
- return recvd;
-}
-
int main(void)
{
apr_status_t rv;
@@ -70,7 +51,7 @@ int main(void)
boxes = apr_shm_baseaddr_get(shm);
/* consume messages on all of the boxes */
- recvd = msgwait(30, 0, N_BOXES); /* wait for 30 seconds for messages */
+ recvd = msgwait(MSG, N_MESSAGES, 30, 1);
rv = apr_shm_detach(shm);
if (rv != APR_SUCCESS) {