[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hurd/libpthread sysdeps/mach/hurd/i386/pt-setup...
From: |
Neal H. Walfield |
Subject: |
hurd/libpthread sysdeps/mach/hurd/i386/pt-setup... |
Date: |
Mon, 18 Nov 2002 17:20:59 -0500 |
CVSROOT: /cvsroot/hurd
Module name: hurd
Changes by: Neal H. Walfield <address@hidden> 02/11/18 17:20:58
Modified files:
libpthread/sysdeps/mach/hurd/i386: pt-setup.c
libpthread/sysdeps/mach/hurd: pt-sysdep.h pt-docancel.c
libpthread/sysdeps/mach: pt-wakeup.c pt-thread-start.c
pt-thread-alloc.c
libpthread/sysdeps/l4: pt-start.c
libpthread/sysdeps/generic: pt-rwlock-timedwrlock.c
pt-rwlock-timedrdlock.c
pt-mutex-timedlock.c
pt-cond-timedwait.c
libpthread : ChangeLog
Removed files:
libpthread/sysdeps/mach: pt-start.c
Log message:
2002-11-18 Neal H. Walfield <address@hidden>
* sysdeps/mach/pt-wakeup.c (__pthread_wakeup): Use the size of
THREAD->wakeupmsg which may not be a mach_msg_header_t.
* sysdeps/generic/pt-mutex-timedlock.c
(__pthread_mutex_timedlock_internal): Really test for equality.
* sysdeps/generic/pt-rwlock-timedrdlock.c
(__pthread_rwlock_timedrdlock_internal): Likewise.
* sysdeps/generic/pt-rwlock-timedwrlock.c
(__pthread_rwlock_timedwrlock_internal): Likewise.
* sysdeps/generic/pt-cond-timedwait.c
(__pthread_cond_timedwait_internal): On timeout, remove our thread
structure from the wait queue if necessary.
* sysdeps/l4/pt-start.c (__pthread_start): Call L4_Myself, not
__mach_thread_self.
* sysdeps/mach/hurd/i386/pt-setup.c: Include <mach.h>.
(__pthread_setup): Do not leak references from __mach_thread_self.
* sysdeps/mach/hurd/pt-docancel.c (__pthread_do_cancel): Likewise.
* sysdeps/mach/hurd/pt-sysdep.h (_pthread_self): Likewise.
* sysdeps/mach/pt-thread-alloc.c (__pthread_thread_alloc): Likewise.
* sysdeps/mach/pt-thread-start.c (__pthread_thread_start): Likewise.
* sysdeps/mach/pt-start.c: Remove dead file.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/mach/hurd/i386/pt-setup.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/mach/hurd/pt-sysdep.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/mach/hurd/pt-docancel.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/mach/pt-wakeup.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/mach/pt-thread-start.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/mach/pt-thread-alloc.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/l4/pt-start.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/generic/pt-rwlock-timedwrlock.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/generic/pt-rwlock-timedrdlock.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/sysdeps/generic/pt-cond-timedwait.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libpthread/ChangeLog.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: hurd/libpthread/ChangeLog
diff -u hurd/libpthread/ChangeLog:1.4 hurd/libpthread/ChangeLog:1.5
--- hurd/libpthread/ChangeLog:1.4 Sat Nov 9 23:18:18 2002
+++ hurd/libpthread/ChangeLog Mon Nov 18 17:20:58 2002
@@ -1,3 +1,31 @@
+2002-11-18 Neal H. Walfield <address@hidden>
+
+ * sysdeps/mach/pt-wakeup.c (__pthread_wakeup): Use the size of
+ THREAD->wakeupmsg which may not be a mach_msg_header_t.
+
+ * sysdeps/generic/pt-mutex-timedlock.c
+ (__pthread_mutex_timedlock_internal): Really test for equality.
+ * sysdeps/generic/pt-rwlock-timedrdlock.c
+ (__pthread_rwlock_timedrdlock_internal): Likewise.
+ * sysdeps/generic/pt-rwlock-timedwrlock.c
+ (__pthread_rwlock_timedwrlock_internal): Likewise.
+
+ * sysdeps/generic/pt-cond-timedwait.c
+ (__pthread_cond_timedwait_internal): On timeout, remove our thread
+ structure from the wait queue if necessary.
+
+ * sysdeps/l4/pt-start.c (__pthread_start): Call L4_Myself, not
+ __mach_thread_self.
+
+ * sysdeps/mach/hurd/i386/pt-setup.c: Include <mach.h>.
+ (__pthread_setup): Do not leak references from __mach_thread_self.
+ * sysdeps/mach/hurd/pt-docancel.c (__pthread_do_cancel): Likewise.
+ * sysdeps/mach/hurd/pt-sysdep.h (_pthread_self): Likewise.
+ * sysdeps/mach/pt-thread-alloc.c (__pthread_thread_alloc): Likewise.
+ * sysdeps/mach/pt-thread-start.c (__pthread_thread_start): Likewise.
+
+ * sysdeps/mach/pt-start.c: Remove dead file.
+
2002-11-09 Roland McGrath <address@hidden>
* include/pthread/pthread.h: Avoid `__thread' as an identifier,
@@ -6,8 +34,8 @@
2002-11-02 Alfred M. Szmidt <address@hidden>
* sysdeps/generic/pt-key-delete.c, sysdeps/hurd/pt-key-delete.c
- (pthread_key_delete): Renamed from pthread_key_destroy. Reported
- by Michael Koch <address@hidden>
+ (pthread_key_delete): Renamed from pthread_key_destroy.
+ Reported by Michael Koch <address@hidden>
2002-10-12 Neal H. Walfield <address@hidden>
Index: hurd/libpthread/sysdeps/generic/pt-cond-timedwait.c
diff -u hurd/libpthread/sysdeps/generic/pt-cond-timedwait.c:1.1
hurd/libpthread/sysdeps/generic/pt-cond-timedwait.c:1.2
--- hurd/libpthread/sysdeps/generic/pt-cond-timedwait.c:1.1 Thu Oct 10
19:05:06 2002
+++ hurd/libpthread/sysdeps/generic/pt-cond-timedwait.c Mon Nov 18 17:20:58 2002
@@ -73,7 +73,28 @@
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &canceltype);
if (abstime)
- err = __pthread_timedblock (self, abstime);
+ {
+ error_t err;
+
+ err = __pthread_timedblock (self, abstime);
+ if (err)
+ /* We timed out. We may need to disconnect ourself from the
+ waiter queue.
+
+ FIXME: What do we do if we get a wakeup message before we
+ disconnect ourself? It may remain until the next time we
+ block. */
+ {
+ assert (err == ETIMEDOUT);
+
+ __pthread_spin_lock (&mutex->__lock);
+ if (self->prevp)
+ __pthread_dequeue (self);
+ __pthread_spin_unlock (&mutex->__lock);
+
+ return err;
+ }
+ }
else
{
err = 0;
Index: hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c
diff -u hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c:1.1
hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c:1.2
--- hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c:1.1 Thu Oct 10
19:05:06 2002
+++ hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c Mon Nov 18
17:20:58 2002
@@ -114,7 +114,7 @@
disconnect ourself? It may remain until the next time we
block. */
{
- assert (err = ETIMEDOUT);
+ assert (err == ETIMEDOUT);
__pthread_spin_lock (&mutex->__lock);
if (self->prevp)
Index: hurd/libpthread/sysdeps/generic/pt-rwlock-timedrdlock.c
diff -u hurd/libpthread/sysdeps/generic/pt-rwlock-timedrdlock.c:1.1
hurd/libpthread/sysdeps/generic/pt-rwlock-timedrdlock.c:1.2
--- hurd/libpthread/sysdeps/generic/pt-rwlock-timedrdlock.c:1.1 Thu Oct 10
19:05:06 2002
+++ hurd/libpthread/sysdeps/generic/pt-rwlock-timedrdlock.c Mon Nov 18
17:20:58 2002
@@ -86,7 +86,7 @@
disconnect ourself? It may remain until the next time we
block. */
{
- assert (err = ETIMEDOUT);
+ assert (err == ETIMEDOUT);
__pthread_spin_lock (&rwlock->__lock);
if (self->prevp)
Index: hurd/libpthread/sysdeps/generic/pt-rwlock-timedwrlock.c
diff -u hurd/libpthread/sysdeps/generic/pt-rwlock-timedwrlock.c:1.1
hurd/libpthread/sysdeps/generic/pt-rwlock-timedwrlock.c:1.2
--- hurd/libpthread/sysdeps/generic/pt-rwlock-timedwrlock.c:1.1 Thu Oct 10
19:05:06 2002
+++ hurd/libpthread/sysdeps/generic/pt-rwlock-timedwrlock.c Mon Nov 18
17:20:58 2002
@@ -72,7 +72,7 @@
disconnect ourself? It may remain until the next time we
block. */
{
- assert (err = ETIMEDOUT);
+ assert (err == ETIMEDOUT);
__pthread_spin_lock (&rwlock->__lock);
if (self->prevp)
Index: hurd/libpthread/sysdeps/l4/pt-start.c
diff -u hurd/libpthread/sysdeps/l4/pt-start.c:1.1
hurd/libpthread/sysdeps/l4/pt-start.c:1.2
--- hurd/libpthread/sysdeps/l4/pt-start.c:1.1 Thu Oct 10 19:05:05 2002
+++ hurd/libpthread/sysdeps/l4/pt-start.c Mon Nov 18 17:20:58 2002
@@ -69,7 +69,7 @@
/* The main thread is already running: do nothing. */
{
assert (__pthread_total == 1);
- thread->threadid = __mach_thread_self ();
+ thread->threadid = L4_Myself ();
}
else
{
Index: hurd/libpthread/sysdeps/mach/hurd/i386/pt-setup.c
diff -u hurd/libpthread/sysdeps/mach/hurd/i386/pt-setup.c:1.1
hurd/libpthread/sysdeps/mach/hurd/i386/pt-setup.c:1.2
--- hurd/libpthread/sysdeps/mach/hurd/i386/pt-setup.c:1.1 Thu Oct 10
19:05:05 2002
+++ hurd/libpthread/sysdeps/mach/hurd/i386/pt-setup.c Mon Nov 18 17:20:58 2002
@@ -1,5 +1,5 @@
/* Setup thread stack. Hurd/i386 version.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <assert.h>
+#include <mach.h>
#include <pt-internal.h>
@@ -83,17 +84,20 @@
void *(*start_routine)(void *), void *arg)
{
error_t err;
+ mach_port_t ktid;
thread->mcontext.pc = entry_point;
thread->mcontext.sp = stack_setup (thread, start_routine, arg);
- if (thread->kernel_thread != __mach_thread_self ())
+ ktid = __mach_port_self ();
+ if (thread->kernel_thread != ktid)
{
err = __thread_set_pcsp (thread->kernel_thread,
1, thread->mcontext.pc,
1, thread->mcontext.sp);
assert_perror (err);
}
+ __mach_port_deallocate (__mach_task_self (), ktid);
return 0;
}
Index: hurd/libpthread/sysdeps/mach/hurd/pt-docancel.c
diff -u hurd/libpthread/sysdeps/mach/hurd/pt-docancel.c:1.1
hurd/libpthread/sysdeps/mach/hurd/pt-docancel.c:1.2
--- hurd/libpthread/sysdeps/mach/hurd/pt-docancel.c:1.1 Thu Oct 10 19:05:05 2002
+++ hurd/libpthread/sysdeps/mach/hurd/pt-docancel.c Mon Nov 18 17:20:58 2002
@@ -30,10 +30,17 @@
int
__pthread_do_cancel (struct __pthread *p)
{
+ mach_port_t ktid;
+ int me;
+
assert (p->cancel_pending = 1);
assert (p->cancel_state == PTHREAD_CANCEL_ENABLE);
- if (__mach_thread_self () == p->kernel_thread)
+ ktid = __mach_thread_self ();
+ me = p->kernel_thread == ktid;
+ __mach_port_deallocate (__mach_task_self (), ktid);
+
+ if (me)
call_exit ();
else
{
Index: hurd/libpthread/sysdeps/mach/hurd/pt-sysdep.h
diff -u hurd/libpthread/sysdeps/mach/hurd/pt-sysdep.h:1.1
hurd/libpthread/sysdeps/mach/hurd/pt-sysdep.h:1.2
--- hurd/libpthread/sysdeps/mach/hurd/pt-sysdep.h:1.1 Thu Oct 10 19:05:05 2002
+++ hurd/libpthread/sysdeps/mach/hurd/pt-sysdep.h Mon Nov 18 17:20:58 2002
@@ -1,5 +1,5 @@
/* Internal defenitions for pthreads library.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -45,7 +45,10 @@
__hurd_threadvar_location (_HURD_THREADVAR_THREAD); \
\
assert (thread); \
- assert (thread->kernel_thread == __mach_thread_self ()); \
+ assert (({ mach_port_t ktid = __mach_thread_self (); \
+ int ok = thread->kernel_thread == ktid; \
+ __mach_port_deallocate (__mach_task_self (), ktid);\
+ ok; })); \
thread; \
})
Index: hurd/libpthread/sysdeps/mach/pt-thread-alloc.c
diff -u hurd/libpthread/sysdeps/mach/pt-thread-alloc.c:1.1
hurd/libpthread/sysdeps/mach/pt-thread-alloc.c:1.2
--- hurd/libpthread/sysdeps/mach/pt-thread-alloc.c:1.1 Thu Oct 10 19:05:05 2002
+++ hurd/libpthread/sysdeps/mach/pt-thread-alloc.c Mon Nov 18 17:20:58 2002
@@ -86,6 +86,8 @@
{
assert (__pthread_total == 0);
thread->kernel_thread = __mach_thread_self ();
+ /* We implicitly hold a reference. */
+ __mach_port_deallocate (__mach_task_self (), thread->kernel_thread);
}
else
{
Index: hurd/libpthread/sysdeps/mach/pt-thread-start.c
diff -u hurd/libpthread/sysdeps/mach/pt-thread-start.c:1.1
hurd/libpthread/sysdeps/mach/pt-thread-start.c:1.2
--- hurd/libpthread/sysdeps/mach/pt-thread-start.c:1.1 Thu Oct 10 19:05:05 2002
+++ hurd/libpthread/sysdeps/mach/pt-thread-start.c Mon Nov 18 17:20:58 2002
@@ -33,7 +33,11 @@
{
/* The main thread is already running: do nothing. */
assert (__pthread_total == 1);
- assert (thread->kernel_thread == __mach_thread_self ());
+ assert (({ mach_port_t ktid = __mach_thread_self ();
+ int ok = thread->kernel_thread == ktid;
+ __mach_port_deallocate (__mach_task_self (),
+ thread->kernel_thread);
+ ok; }));
}
else
{
Index: hurd/libpthread/sysdeps/mach/pt-wakeup.c
diff -u hurd/libpthread/sysdeps/mach/pt-wakeup.c:1.1
hurd/libpthread/sysdeps/mach/pt-wakeup.c:1.2
--- hurd/libpthread/sysdeps/mach/pt-wakeup.c:1.1 Thu Oct 10 19:05:05 2002
+++ hurd/libpthread/sysdeps/mach/pt-wakeup.c Mon Nov 18 17:20:58 2002
@@ -1,5 +1,5 @@
/* Wakeup a thread. Mach version.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@
error_t err;
err = __mach_msg (&thread->wakeupmsg, MACH_SEND_MSG,
- sizeof (mach_msg_header_t), 0, MACH_PORT_NULL,
+ sizeof (thread->wakeupmsg), 0, MACH_PORT_NULL,
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
assert_perror (err);
}
- hurd/libpthread sysdeps/mach/hurd/i386/pt-setup...,
Neal H. Walfield <=