glibc-2.2.4pre1 results
Ulrich Drepper
drepper@redhat.com
Tue Jul 31 12:43:00 GMT 2001
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 `------------------------
More information about the Libc-alpha
mailing list