about summary refs log tree commit diff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-11-03 06:13:09 +0000
committerUlrich Drepper <drepper@redhat.com>1999-11-03 06:13:09 +0000
commitab86fbb1d2866df567219904982dac61751808e5 (patch)
tree7ef290b73205d2a02ca808b585984d6c562857b0 /linuxthreads
parentdbd3e8629f6efb51bcddbd9e85ab87c0dd95a6ee (diff)
downloadglibc-ab86fbb1d2866df567219904982dac61751808e5.tar.gz
glibc-ab86fbb1d2866df567219904982dac61751808e5.tar.xz
glibc-ab86fbb1d2866df567219904982dac61751808e5.zip
Update.
	* internals.h: Declare __pthread_last_event.
	* manager.c: Define __pthread_last_event.
	(pthread_handle_create): Set __pthread_last_event.
	(pthread_exited): Likewise.
	* join.c (pthread_exit): Likewise.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog6
-rw-r--r--linuxthreads/internals.h3
-rw-r--r--linuxthreads/join.c1
-rw-r--r--linuxthreads/manager.c5
4 files changed, 15 insertions, 0 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 6d00c17699..a670e9f93a 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,5 +1,11 @@
 1999-11-02  Ulrich Drepper  <drepper@cygnus.com>
 
+	* internals.h: Declare __pthread_last_event.
+	* manager.c: Define __pthread_last_event.
+	(pthread_handle_create): Set __pthread_last_event.
+	(pthread_exited): Likewise.
+	* join.c (pthread_exit): Likewise.
+
 	* Makefile (libpthread-routines): Add events.
 	* events.c: New file.
 	* internals.h: Protect against multiple inclusion.
diff --git a/linuxthreads/internals.h b/linuxthreads/internals.h
index 531b0424d8..f9eba6b94c 100644
--- a/linuxthreads/internals.h
+++ b/linuxthreads/internals.h
@@ -229,6 +229,9 @@ extern volatile int __pthread_threads_debug;
 /* Globally enabled events.  */
 extern volatile td_thr_events_t __pthread_threads_events;
 
+/* Pointer to descriptor of thread with last event.  */
+extern volatile pthread_descr __pthread_last_event;
+
 /* Return the handle corresponding to a thread id */
 
 static inline pthread_handle thread_handle(pthread_t id)
diff --git a/linuxthreads/join.c b/linuxthreads/join.c
index a2c8b20ca2..71db541391 100644
--- a/linuxthreads/join.c
+++ b/linuxthreads/join.c
@@ -54,6 +54,7 @@ void pthread_exit(void * retval)
 	  /* Yep, we have to signal the death.  */
 	  THREAD_SETMEM(self, p_eventbuf.eventnum, TD_DEATH);
 	  THREAD_SETMEM(self, p_eventbuf.eventdata, self);
+	  __pthread_last_event = self;
 
 	  /* Now call the function to signal the event.  */
 	  __linuxthreads_death_event();
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 3b70097232..21a3f6875f 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -55,6 +55,9 @@ volatile int __pthread_threads_debug;
 /* Globally enabled events.  */
 volatile td_thr_events_t __pthread_threads_events;
 
+/* Pointer to thread descriptor with last event.  */
+volatile pthread_descr __pthread_last_event;
+
 /* Mapping from stack segment to thread descriptor. */
 /* Stack segment numbers are also indices into the __pthread_handles array. */
 /* Stack segment number 0 is reserved for the initial thread. */
@@ -422,6 +425,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
 		 already scheduled when we send the event.  */
 	      new_thread->p_eventbuf.eventdata = new_thread;
 	      new_thread->p_eventbuf.eventnum = TD_CREATE;
+	      __pthread_last_event = new_thread;
 
 	      /* Now call the function which signals the event.  */
 	      __linuxthreads_create_event ();
@@ -523,6 +527,7 @@ static void pthread_exited(pid_t pid)
 	      /* Yep, we have to signal the death.  */
 	      th->p_eventbuf.eventnum = TD_DEATH;
 	      th->p_eventbuf.eventdata = th;
+	      __pthread_last_event = th;
 
 	      /* Now call the function to signal the event.  */
 	      __linuxthreads_reap_event();