about summary refs log tree commit diff
path: root/linuxthreads/Examples
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-07-31 20:32:01 +0000
committerUlrich Drepper <drepper@redhat.com>2001-07-31 20:32:01 +0000
commitad71126b24491c31fd99b4ca8010cd1363f1c016 (patch)
treeb788d320c7c35e7b1eaca2e18973d55b3a5b2242 /linuxthreads/Examples
parent34183f57d75b4e8b9ed6608f888f0f1e1ada8b34 (diff)
downloadglibc-ad71126b24491c31fd99b4ca8010cd1363f1c016.tar.gz
glibc-ad71126b24491c31fd99b4ca8010cd1363f1c016.tar.xz
glibc-ad71126b24491c31fd99b4ca8010cd1363f1c016.zip
Update.
	* sysdeps/unix/sysv/linux/cmsg_nxthdr.c (__cmsg_nxthdr): Correct
	test for cmsg struct size.
	* sysdeps/unix/sysv/linux/bits/socket.h (__cmsg_nxthdr): Likewise.

	* sysdeps/unix/sysv/linux/i386/makecontext.S: Remove unnecessary
	initializations.

	* libio/oldiopopen.c: Add lock for old_proc_file_chain access.
Diffstat (limited to 'linuxthreads/Examples')
-rw-r--r--linuxthreads/Examples/ex17.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/linuxthreads/Examples/ex17.c b/linuxthreads/Examples/ex17.c
index f5c99ee3fb..a3ab909990 100644
--- a/linuxthreads/Examples/ex17.c
+++ b/linuxthreads/Examples/ex17.c
@@ -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)
     {
@@ -85,6 +95,13 @@ main (void)
       return 3;
     }
 
+  status = pthread_mutex_unlock (&synch);
+  if (status != 0)
+    {
+      printf ("cannot release lock: %s\n", strerror (status));
+      return 1;
+    }
+
   /* pthread_detach (thread); */
   if (pthread_join (thread, NULL) != 0)
     {