From 2385d1bdc895fe3793615f014f64bbc4a5f0d1a1 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 15 Apr 2010 15:25:10 +0000 Subject: [PATCH] * Replaced bogus perror() calls with printf()s. * Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36297 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../interfaces/pthread_detach/2-1.c | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-1.c index d6dff12bed..17c5c4c55e 100644 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-1.c +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-1.c @@ -1,12 +1,12 @@ -/* +/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this + * of this license, see the COPYING file at the top level of this * source tree. * Test that pthread_detach() - * + * * If 'thread' has not terminated, pthread_detach() shall not cause it to * terminate. The effect of multiple pthread_detach() calls on the same * @@ -14,25 +14,26 @@ * 1.Create a joinable thread * 2.Detach that thread * 3.Verify that the thread did not terminate because of this - * + * */ +#include #include #include -#include +#include #include #include "posixtest.h" void *a_thread_func() { - + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); /* If the thread wasn't canceled in 10 seconds, time out */ - sleep(10); + sleep(10); - perror("Thread couldn't be canceled (at cleanup time), timing out\n"); + printf("Thread couldn't be canceled (at cleanup time), timing out\n"); pthread_exit(0); return NULL; } @@ -46,21 +47,21 @@ int main() /* Initialize attribute */ if(pthread_attr_init(&new_attr) != 0) { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to be joinable */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != 0) - { - perror("Error in pthread_attr_setdetachstate()\n"); + printf("Cannot initialize attribute object\n"); return PTS_UNRESOLVED; } - /* Create the thread */ + /* Set the attribute object to be joinable */ + if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != 0) + { + printf("Error in pthread_attr_setdetachstate()\n"); + return PTS_UNRESOLVED; + } + + /* Create the thread */ if(pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); + { + printf("Error creating thread\n"); return PTS_UNRESOLVED; } @@ -71,7 +72,7 @@ int main() return PTS_FAIL; } - /* Verify that it hasn't terminated the thread */ + /* Verify that it hasn't terminated the thread */ ret=pthread_cancel(new_th); if(ret != 0) @@ -81,7 +82,7 @@ int main() printf("Test FAILED\n"); return PTS_FAIL; } - perror("Error canceling thread\n"); + printf("Error canceling thread: %s\n", strerror(ret)); return PTS_UNRESOLVED; }