This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix tst-cond12.c


Hi!

tst-cond13.c defines USE_COND_SIGNAL but nothing was using that define.
Also, there were warnings because add_temp_file was used without prototype.
This patch also has an unrelated change which I had in my tree
(tst-cleanup4aux.c not in distribute).

2003-11-21  Jakub Jelinek  <jakub@redhat.com>

	* Makefile (distribute): tst-cleanup4aux.c.

	* tst-cond12.c (prepare): Add prototype.  Move after test-skeleton.c
	include.
	(do_test): If USE_COND_SIGNAL is defined, use pthread_cond_signal
	instead of pthread_cond_broadcast.

--- libc/nptl/Makefile.jj	2003-11-21 12:14:18.000000000 +0100
+++ libc/nptl/Makefile	2003-11-21 12:01:34.000000000 +0100
@@ -234,7 +234,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
 	tst-context1 \
 	tst-sched1
 
-distribute = eintr.c
+distribute = eintr.c tst-cleanup4aux.c
 
 gen-as-const-headers = pthread-errnos.sym
 
--- libc/nptl/tst-cond12.c.jj	2003-11-21 10:19:51.000000000 +0100
+++ libc/nptl/tst-cond12.c	2003-11-21 12:21:55.000000000 +0100
@@ -30,6 +30,13 @@
 static char fname[] = "/tmp/tst-cond12-XXXXXX";
 static int fd;
 
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
 
 static void
 prepare (void)
@@ -47,13 +54,6 @@ prepare (void)
       exit (1);
     }
 }
-#define PREPARE(argc, argv) prepare ()
-
-
-static int do_test (void);
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
-
 
 static int
 do_test (void)
@@ -152,12 +152,21 @@ do_test (void)
 
       p->var = 0;
 
+#ifdef USE_COND_SIGNAL
+      if (pthread_cond_signal (&p->c) != 0)
+	{
+	  puts ("child: cond_broadcast failed");
+	  kill (getppid (), SIGKILL);
+	  exit (1);
+	}
+#else
       if (pthread_cond_broadcast (&p->c) != 0)
 	{
 	  puts ("child: cond_broadcast failed");
 	  kill (getppid (), SIGKILL);
 	  exit (1);
 	}
+#endif
 
       if (pthread_mutex_unlock (&p->m) != 0)
 	{

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]