]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Don't hang on some old systems, since that makes the entire regtest
authorJulian Seward <jseward@acm.org>
Sun, 11 Nov 2007 05:52:36 +0000 (05:52 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 11 Nov 2007 05:52:36 +0000 (05:52 +0000)
system hang.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7143

helgrind/tests/tc18_semabuse.c

index 6e26ce411d237f81170c0c68f43762701ad58fe5..1fbc41928fa26be479d38bece4a5923258f33d94 100644 (file)
@@ -6,19 +6,19 @@
 
 /* This is pretty lame, because making the sem_ functions fail is
    difficult.  Not sure it's really worth having. */
-
+#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <pthread.h>
 #include <semaphore.h>
 #include <string.h>
-
+void start_watchdog ( void );
 int main ( void )
 {
   int r;
   sem_t s1;
-
+  start_watchdog();
   /* Do sem_init with huge initial count */
   r= sem_init(&s1, 0, ~0);
 
@@ -40,3 +40,18 @@ int main ( void )
 
   return 0;
 }
+
+void* watchdog ( void* v )
+{
+  sleep(10);
+  fprintf(stderr, "watchdog timer expired - not a good sign\n");
+  exit(0);
+}
+
+void start_watchdog ( void )
+{
+  pthread_t t;
+  int r;
+  r= pthread_create(&t, NULL, watchdog, NULL);
+  assert(!r);
+}