|
From: <sv...@va...> - 2007-11-11 05:52:35
|
Author: sewardj
Date: 2007-11-11 05:52:36 +0000 (Sun, 11 Nov 2007)
New Revision: 7143
Log:
Don't hang on some old systems, since that makes the entire regtest
system hang.
Modified:
trunk/helgrind/tests/tc18_semabuse.c
Modified: trunk/helgrind/tests/tc18_semabuse.c
===================================================================
--- trunk/helgrind/tests/tc18_semabuse.c 2007-11-11 01:20:14 UTC (rev 7142)
+++ trunk/helgrind/tests/tc18_semabuse.c 2007-11-11 05:52:36 UTC (rev 7143)
@@ -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 @@
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);
+}
|