diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-11 01:13:43 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-11 01:20:03 +0100 |
commit | 3b14ab0254a131e458c4f5ffdee931e868206424 (patch) | |
tree | 0a88ed88851e966d3c5f2ac08b4eb243c99c96b0 /libthreads/cancel-cond.c | |
parent | 986c7a7d686a850830f9fc5bea1fadcfe9f4999c (diff) | |
download | hurd-3b14ab0254a131e458c4f5ffdee931e868206424.tar.gz hurd-3b14ab0254a131e458c4f5ffdee931e868206424.tar.bz2 hurd-3b14ab0254a131e458c4f5ffdee931e868206424.zip |
libthreads: Remove
libthreads is most probably completely broken, and not the long-term
road anyway.
* config.make.in (VERSIONING): Remove.
* configure.ac: Test for pfinet assembly compatibility instead of
libthreads assembly compatibility. Do not set VERSIONING.
* libthreads: Remove directory.
* Makefile (lib-subdirs): Remove libthreads.
* doc/hurd.texi (Threads Library): Rename references to libthreads into
libpthread.
* release/rfloppy.copy: Do not objcopy lib/libthreads.so.
* release/tool-Makefile (rfloppy-solib): Remove libthreads.
Diffstat (limited to 'libthreads/cancel-cond.c')
-rw-r--r-- | libthreads/cancel-cond.c | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/libthreads/cancel-cond.c b/libthreads/cancel-cond.c deleted file mode 100644 index 3aa33f6a..00000000 --- a/libthreads/cancel-cond.c +++ /dev/null @@ -1,116 +0,0 @@ -/* Modified condition_wait that checks for cancellation. - Copyright (C) 1995, 1996 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, write to the Free Software Foundation, Inc., 675 Mass Ave, - Cambridge, MA 02139, USA. */ - -#include <hurd/signal.h> -#include <cthreads.h> -#include "cthread_internals.h" -#include <assert-backtrace.h> - -/* Just like condition_wait, but cancellable. Returns true if cancelled. */ -int -hurd_condition_wait (condition_t c, mutex_t m) -{ - /* This function will be called by hurd_thread_cancel while we are blocked - in the condition_wait. We wake up all threads blocked on C, - so our thread will wake up and notice the cancellation flag. */ - void cancel_me (void) - { - condition_broadcast (c); - } - struct hurd_sigstate *ss = _hurd_self_sigstate (); - cproc_t p = cproc_self (); - int cancel; - - assert_backtrace (ss->intr_port == MACH_PORT_NULL); /* Sanity check for signal bugs. */ - - p->state = CPROC_CONDWAIT | CPROC_SWITCHING; - - /* Atomically enqueue our cproc on the condition variable's queue of - waiters, and mark our sigstate to indicate that `cancel_me' must be - called to wake us up. We must hold the sigstate lock while acquiring - the condition variable's lock and tweaking it, so that - hurd_thread_cancel can never suspend us and then deadlock in - condition_broadcast waiting for the condition variable's lock. */ - - spin_lock (&ss->lock); - spin_lock (&c->lock); - cancel = ss->cancel; - if (cancel) - /* We were cancelled before doing anything. Don't block at all. */ - ss->cancel = 0; - else - { - /* Put us on the queue so that condition_broadcast will know to wake - us up. */ - cthread_queue_enq (&c->queue, p); - /* Tell hurd_thread_cancel how to unblock us. */ - ss->cancel_hook = &cancel_me; - } - spin_unlock (&c->lock); - spin_unlock (&ss->lock); - - if (cancel) - { - /* Cancelled on entry. Just leave the mutex locked. */ - m = NULL; - p->state = CPROC_RUNNING; - } - else - { - /* Now unlock the mutex and block until woken. */ - -#ifdef WAIT_DEBUG - p->waiting_for = (char *)c; -#endif /* WAIT_DEBUG */ - - mutex_unlock (m); - - spin_lock (&p->lock); - if (p->state & CPROC_SWITCHING) - cproc_block (); - else - { - /* We were woken up someplace before reacquiring P->lock. - We can just continue on. */ - p->state = CPROC_RUNNING; - spin_unlock(&p->lock); - } - -#ifdef WAIT_DEBUG - p->waiting_for = (char *)0; -#endif /* WAIT_DEBUG */ - } - - spin_lock (&ss->lock); - /* Clear the hook, now that we are done blocking. */ - ss->cancel_hook = NULL; - /* Check the cancellation flag; we might have unblocked due to - cancellation rather than a normal condition_signal or - condition_broadcast (or we might have just happened to get cancelled - right after waking up). */ - cancel |= ss->cancel; - ss->cancel = 0; - spin_unlock (&ss->lock); - - if (m) - /* Reacquire the mutex and return. */ - mutex_lock (m); - - return cancel; -} |