This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: glibc-2.2.4pre1 results
- To: "Art Haas" <ahaas at neosoft dot com>
- Subject: Re: glibc-2.2.4pre1 results
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 31 Jul 2001 12:38:12 -0700
- Cc: libc-alpha at sources dot redhat dot com
- References: <20010730181908.A30136@localhost.neosoft.com>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
What about this patch:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: ex17.c
===================================================================
RCS file: /cvs/glibc/libc/linuxthreads/Examples/ex17.c,v
retrieving revision 1.2
diff -u -d -u -p -r1.2 ex17.c
--- ex17.c 2001/03/27 03:05:04 1.2
+++ ex17.c 2001/07/31 19:39:38
@@ -6,9 +6,12 @@
#include <limits.h>
#include <sys/mman.h>
+static pthread_mutex_t synch = PTHREAD_MUTEX_INITIALIZER;
+
static void *
test_thread (void *v_param)
{
+ pthread_mutex_lock (&synch);
return NULL;
}
@@ -56,6 +59,13 @@ main (void)
return 2;
}
+ status = pthread_mutex_lock (&synch);
+ if (status != 0)
+ {
+ printf ("cannot get lock: %s\n", strerror (status));
+ return 1;
+ }
+
status = pthread_create (&thread, &attr, test_thread, NULL);
if (status != 0)
{
@@ -83,6 +93,13 @@ main (void)
"than was set by setstack (%p,%x)\n",
stack2, stacksize, stack, STACKSIZE);
return 3;
+ }
+
+ status = pthread_mutex_unlock (&synch);
+ if (status != 0)
+ {
+ printf ("cannot release lock: %s\n", strerror (status));
+ return 1;
}
/* pthread_detach (thread); */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I've already checked this one in.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------