You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2007/10/17 11:04:28 UTC

svn commit: r585420 - /apr/apr-util/trunk/test/testqueue.c

Author: wrowe
Date: Wed Oct 17 02:04:27 2007
New Revision: 585420

URL: http://svn.apache.org/viewvc?rev=585420&view=rev
Log:
Small improvements for legibility

Modified:
    apr/apr-util/trunk/test/testqueue.c

Modified: apr/apr-util/trunk/test/testqueue.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/test/testqueue.c?rev=585420&r1=585419&r2=585420&view=diff
==============================================================================
--- apr/apr-util/trunk/test/testqueue.c (original)
+++ apr/apr-util/trunk/test/testqueue.c Wed Oct 17 02:04:27 2007
@@ -42,14 +42,15 @@
     sleeprate = 1000000/CONSUMER_ACTIVITY;
     apr_sleep((rand() % 4) * 1000000); /* sleep random seconds */
 
-    while (1) {
+    while (1)
+    {
         rv = apr_queue_pop(queue, &v);
 
-        if (rv == APR_EINTR) {
+        if (rv == APR_EINTR)
             continue;
-        } else if (rv == APR_EOF) {
+
+        if (rv == APR_EOF)
             break;
-        }
 
         ABTS_TRUE(tc, v == NULL);
         ABTS_TRUE(tc, rv == APR_SUCCESS);
@@ -57,29 +58,39 @@
         apr_sleep(sleeprate); /* sleep this long to acheive our rate */
     }
 
+    apr_thread_exit(thd, rv);
+
+    /* not reached */
     return NULL;
 }
 
 static void * APR_THREAD_FUNC producer(apr_thread_t *thd, void *data)
 {
     long sleeprate;
+    abts_case *tc = data;
     apr_status_t rv;
 
     sleeprate = 1000000/PRODUCER_ACTIVITY;
     apr_sleep((rand() % 4) * 1000000); /* sleep random seconds */
 
-    while (1) {
-        do {
-            rv = apr_queue_push(queue, NULL);
-        } while (rv == APR_EINTR);
+    while (1)
+    {
+        rv = apr_queue_push(queue, NULL);
+
+        if (rv == APR_EINTR)
+            continue;
 
-        if (rv == APR_EOF) {
+        if (rv == APR_EOF)
             break;
-        }
+
+        ABTS_TRUE(tc, rv == APR_SUCCESS);
 
         apr_sleep(sleeprate); /* sleep this long to acheive our rate */
     }
 
+    apr_thread_exit(thd, rv);
+
+    /* not reached */
     return NULL;
 }