about summary refs log tree commit diff
path: root/linuxthreads/Examples/ex10.c
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/Examples/ex10.c')
-rw-r--r--linuxthreads/Examples/ex10.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/linuxthreads/Examples/ex10.c b/linuxthreads/Examples/ex10.c
index eee00fa29e..f3ad517283 100644
--- a/linuxthreads/Examples/ex10.c
+++ b/linuxthreads/Examples/ex10.c
@@ -62,6 +62,7 @@ thread (void *arg)
 
       for (;;)
 	{
+	  int err;
 
 	  clock_gettime (CLOCK_REALTIME, &ts);
 
@@ -72,7 +73,7 @@ thread (void *arg)
 	     ts.tv_nsec -= 1000000000L;
 	  }
 
-	  switch (pthread_mutex_timedlock (&mutex, &ts))
+	  switch ((err = pthread_mutex_timedlock (&mutex, &ts)))
 	    {
 	    case 0:
 	      flockfile (stdout);
@@ -86,6 +87,8 @@ thread (void *arg)
 		      (unsigned long) self);
 	      funlockfile (stdout);
 	      continue;
+	    default:
+	      error (EXIT_FAILURE, err, "pthread_mutex_timedlock failure");
 	    }
 	  break;
 	}