From: gowrishankar <[email protected]>

This patch cleans up the test so as to follow C coding style standards.

Signed-off-by: Gowrishankar <[email protected]>
Tested-by: Gowrishankar <[email protected]>
Acked-by: John Stultz <[email protected]>
Acked-by: Darren Hart <[email protected]>
---
 testcases/realtime/func/pi-tests/testpi-5.c |   76 ++++++++++++++-------------
 1 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/testcases/realtime/func/pi-tests/testpi-5.c 
b/testcases/realtime/func/pi-tests/testpi-5.c
index faf3d8d..b3ea6ef 100644
--- a/testcases/realtime/func/pi-tests/testpi-5.c
+++ b/testcases/realtime/func/pi-tests/testpi-5.c
@@ -30,6 +30,7 @@
  *
  *
  * HISTORY
+ *      2010-04-22 Code cleanup by Gowrishankar
  *
  *
  *****************************************************************************/
@@ -39,54 +40,55 @@
 #include <string.h>
 #include <unistd.h>
 #include <librttest.h>
-pthread_mutex_t  child_mutex;
+pthread_mutex_t child_mutex;
 
-void* child_thread (void* arg)
+void *child_thread(void *arg)
 {
-    int ret;
+       int ret;
 
-    ret = pthread_mutex_lock(&child_mutex);
-    if (ret != 0)
-       printf("child thread: Failed to lock child_mutex: %d\n", ret);
-    else
-       printf("child_thread: got lock\n");
+       ret = pthread_mutex_lock(&child_mutex);
+       if (ret != 0)
+               printf("child thread: Failed to lock child_mutex: %d\n", ret);
+       else
+               printf("child_thread: got lock\n");
 
-    sleep(2);
+       sleep(2);
 
-    printf("child_thread: Trying to get lock 2nd time\n");
-    ret = pthread_mutex_lock(&child_mutex);
-    if (ret != 0)
-       printf("child thread: Failed to lock child_mutex: %d\n", ret);
-    else
-       printf("child_thread: got lock 2nd time !!\n");
+       printf("child_thread: Trying to get lock 2nd time\n");
+       ret = pthread_mutex_lock(&child_mutex);
+       if (ret != 0)
+               printf("child thread: Failed to lock child_mutex: %d\n", ret);
+       else
+               printf("child_thread: got lock 2nd time !!\n");
 
-    return NULL;
+       return NULL;
 }
 
-int do_test(int argc, char ** argv)
+int do_test(int argc, char **argv)
 {
-    pthread_mutexattr_t mutexattr;
-    int retc, protocol;
+       pthread_mutexattr_t mutexattr;
+       int retc, protocol;
 
-    if (pthread_mutexattr_init(&mutexattr) != 0) {
-      printf("Failed to init mutexattr\n");
-    };
-    if (pthread_mutexattr_setprotocol(&mutexattr, PTHREAD_PRIO_INHERIT) != 0) {
-      printf("Can't set protocol prio inherit\n");
-    }
-    if (pthread_mutexattr_getprotocol(&mutexattr, &protocol) != 0) {
-      printf("Can't get mutexattr protocol\n");
-    } else {
-      printf("protocol in mutexattr is %d\n", protocol);
-    }
-    if ((retc = pthread_mutex_init(&child_mutex, &mutexattr)) != 0) {
-      printf("Failed to init mutex: %d\n", retc);
-    }
+       if (pthread_mutexattr_init(&mutexattr) != 0)
+               printf("Failed to init mutexattr\n");
 
-    create_other_thread(child_thread, NULL);
-    join_threads();
-    
-    return 0;
+       if (pthread_mutexattr_setprotocol(&mutexattr,\
+               PTHREAD_PRIO_INHERIT) != 0)
+               printf("Can't set protocol prio inherit\n");
+
+       if (pthread_mutexattr_getprotocol(&mutexattr, &protocol) != 0)
+               printf("Can't get mutexattr protocol\n");
+       else
+               printf("protocol in mutexattr is %d\n", protocol);
+
+       retc = pthread_mutex_init(&child_mutex, &mutexattr);
+       if (retc != 0)
+               printf("Failed to init mutex: %d\n", retc);
+
+       create_other_thread(child_thread, NULL);
+       join_threads();
+
+       return 0;
 }
 
 #include "test-skeleton.c"
-- 
1.7.1


------------------------------------------------------------------------------

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to