summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2004-03-19 04:18:42 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-06 22:32:34 +0200
commit0d723d7f3a762f106de2f95af2fdaaa650359d80 (patch)
treed1b0d7355013332e6708a940379c9fedc5177c1b
parent0ba014f072e0d19c16d0584672ec9f65cc451a54 (diff)
2004-03-19 Marcus Brinkmann <marcus@gnu.org>
* sysdeps/l4/bits/pthread-np.h (pthread_pool_add_np, pthread_pool_get_np): New prototypes. * sysdeps/l4/pt-pool-np.c: New file. * Makefile.am (libpthread_a_SOURCES): Add pt-pool-np.c. * sysdeps/l4/pt-thread-alloc.c (__pthread_thread_alloc): Try to allocate thread from pool. * sysdeps/l4/pt-thread-halt.c (__pthread_thread_halt): Add thread to pool after stopping it.
-rw-r--r--Makefile.am1
-rw-r--r--Makefile.in66
-rw-r--r--sysdeps/l4/bits/pthread-np.h6
-rw-r--r--sysdeps/l4/pt-pool-np.c52
-rw-r--r--sysdeps/l4/pt-thread-alloc.c4
-rw-r--r--sysdeps/l4/pt-thread-halt.c6
6 files changed, 101 insertions, 34 deletions
diff --git a/Makefile.am b/Makefile.am
index 24896080..e9cedcb3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,6 +64,7 @@ libpthread_a_SOURCES = pt-attr.c pt-attr-destroy.c pt-attr-getdetachstate.c \
pt-alloc.c \
pt-create.c \
pt-create-np.c \
+ pt-pool-np.c \
pt-equal.c \
pt-dealloc.c \
pt-detach.c \
diff --git a/Makefile.in b/Makefile.in
index 26e32873..58d86455 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.7.3 from Makefile.am.
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
@@ -82,12 +82,15 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+FIG2DEV = @FIG2DEV@
+HURD_LADEN_LOAD_ADDRESS = @HURD_LADEN_LOAD_ADDRESS@
+HURD_PHYSMEM_LOAD_ADDRESS = @HURD_PHYSMEM_LOAD_ADDRESS@
+HURD_WORTEL_LOAD_ADDRESS = @HURD_WORTEL_LOAD_ADDRESS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LATEX = @LATEX@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -196,6 +199,7 @@ libpthread_a_SOURCES = pt-attr.c pt-attr-destroy.c pt-attr-getdetachstate.c \
pt-alloc.c \
pt-create.c \
pt-create-np.c \
+ pt-pool-np.c \
pt-equal.c \
pt-dealloc.c \
pt-detach.c \
@@ -260,6 +264,7 @@ libpthread_a_SOURCES = pt-attr.c pt-attr-destroy.c pt-attr-getdetachstate.c \
pt-getschedparam.c pt-setschedparam.c pt-setschedprio.c
subdir = libpthread
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -289,14 +294,14 @@ am_libpthread_a_OBJECTS = pt-attr.$(OBJEXT) pt-attr-destroy.$(OBJEXT) \
pt-key-create.$(OBJEXT) pt-key-delete.$(OBJEXT) \
pt-getspecific.$(OBJEXT) pt-setspecific.$(OBJEXT) \
pt-once.$(OBJEXT) pt-alloc.$(OBJEXT) pt-create.$(OBJEXT) \
- pt-create-np.$(OBJEXT) pt-equal.$(OBJEXT) pt-dealloc.$(OBJEXT) \
- pt-detach.$(OBJEXT) pt-exit.$(OBJEXT) pt-initialize.$(OBJEXT) \
- pt-join.$(OBJEXT) pt-self.$(OBJEXT) pt-sigmask.$(OBJEXT) \
- pt-spin-inlines.$(OBJEXT) pt-cleanup.$(OBJEXT) \
- pt-setcancelstate.$(OBJEXT) pt-setcanceltype.$(OBJEXT) \
- pt-testcancel.$(OBJEXT) pt-cancel.$(OBJEXT) \
- pt-mutexattr.$(OBJEXT) pt-mutexattr-destroy.$(OBJEXT) \
- pt-mutexattr-init.$(OBJEXT) \
+ pt-create-np.$(OBJEXT) pt-pool-np.$(OBJEXT) pt-equal.$(OBJEXT) \
+ pt-dealloc.$(OBJEXT) pt-detach.$(OBJEXT) pt-exit.$(OBJEXT) \
+ pt-initialize.$(OBJEXT) pt-join.$(OBJEXT) pt-self.$(OBJEXT) \
+ pt-sigmask.$(OBJEXT) pt-spin-inlines.$(OBJEXT) \
+ pt-cleanup.$(OBJEXT) pt-setcancelstate.$(OBJEXT) \
+ pt-setcanceltype.$(OBJEXT) pt-testcancel.$(OBJEXT) \
+ pt-cancel.$(OBJEXT) pt-mutexattr.$(OBJEXT) \
+ pt-mutexattr-destroy.$(OBJEXT) pt-mutexattr-init.$(OBJEXT) \
pt-mutexattr-getprioceiling.$(OBJEXT) \
pt-mutexattr-getprotocol.$(OBJEXT) \
pt-mutexattr-getpshared.$(OBJEXT) \
@@ -415,6 +420,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/pt-mutexattr-setpshared.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pt-mutexattr-settype.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pt-mutexattr.Po ./$(DEPDIR)/pt-once.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/pt-pool-np.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pt-rwlock-attr.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pt-rwlock-destroy.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pt-rwlock-init.Po \
@@ -456,7 +462,7 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libpthread_a_SOURCES)
-DIST_COMMON = ChangeLog Makefile.am Makefile.in TODO
+DIST_COMMON = $(srcdir)/Makefile.in ChangeLog Makefile.am TODO
SOURCES = $(libpthread_a_SOURCES)
all: all-am
@@ -568,6 +574,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-mutexattr-settype.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-mutexattr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-once.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-pool-np.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-rwlock-attr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-rwlock-destroy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-rwlock-init.Po@am__quote@
@@ -606,13 +613,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-timedblock.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt-wakeup.Po@am__quote@
-distclean-depend:
- -rm -rf ./$(DEPDIR)
-
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -623,7 +627,7 @@ distclean-depend:
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -722,7 +726,6 @@ check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
-
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@@ -734,7 +737,7 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- INSTALL_STRIP_FLAG=-s \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
@@ -742,7 +745,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -752,9 +755,10 @@ clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-
-distclean-am: clean-am distclean-compile distclean-depend \
- distclean-generic distclean-tags
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
dvi: dvi-am
@@ -775,7 +779,8 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
@@ -794,14 +799,13 @@ uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
- distclean-depend distclean-generic distclean-tags distdir dvi \
- dvi-am info info-am install install-am install-data \
- install-data-am install-exec install-exec-am install-info \
- install-info-am install-man install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
- uninstall-am uninstall-info-am
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+ ps ps-am tags uninstall uninstall-am uninstall-info-am
vpath %.c $(SYSDEP_PATH)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/sysdeps/l4/bits/pthread-np.h b/sysdeps/l4/bits/pthread-np.h
index b487e6dc..7e807107 100644
--- a/sysdeps/l4/bits/pthread-np.h
+++ b/sysdeps/l4/bits/pthread-np.h
@@ -35,4 +35,10 @@ extern int pthread_create_from_l4_tid_np (pthread_t *thread,
void *(*start_routine)(void *),
void *arg);
+/* Add the thread TID to the internal kernel thread pool. */
+int pthread_pool_add_np (l4_thread_id_t tid);
+
+/* Get the first thread from the pool. */
+l4_thread_id_t pthread_pool_get_np (void);
+
#endif /* bits/pthread-np.h */
diff --git a/sysdeps/l4/pt-pool-np.c b/sysdeps/l4/pt-pool-np.c
new file mode 100644
index 00000000..c59e15a9
--- /dev/null
+++ b/sysdeps/l4/pt-pool-np.c
@@ -0,0 +1,52 @@
+/* Thread pool for L4 threads.
+ Copyright (C) 2004 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <pt-internal.h>
+#include <l4/thread.h>
+
+static pthread_mutex_t pool_lock = PTHREAD_MUTEX_INITIALIZER;
+
+l4_thread_id_t pool_list = l4_nilthread;
+
+/* Add the thread TID to the pthread kernel thread pool. */
+int
+pthread_pool_add_np (l4_thread_id_t tid)
+{
+ __pthread_mutex_lock (&pool_lock);
+ /* FIXME: Do error checking. */
+ l4_set_user_defined_handle_of (tid, pool_list);
+ pool_list = tid;
+ __pthread_mutex_unlock (&pool_lock);
+ return 0;
+}
+
+
+/* Get the first thread from the pool. */
+l4_thread_id_t
+pthread_pool_get_np (void)
+{
+ l4_thread_id_t tid;
+
+ __pthread_mutex_lock (&pool_lock);
+ /* FIXME: Do error checking. */
+ tid = pool_list;
+ pool_list = l4_user_defined_handle_of (tid);
+ __pthread_mutex_unlock (&pool_lock);
+ return tid;
+}
diff --git a/sysdeps/l4/pt-thread-alloc.c b/sysdeps/l4/pt-thread-alloc.c
index 00e99ff9..07784f5f 100644
--- a/sysdeps/l4/pt-thread-alloc.c
+++ b/sysdeps/l4/pt-thread-alloc.c
@@ -36,6 +36,10 @@ __pthread_thread_alloc (struct __pthread *thread)
}
else
{
+ thread->threadid = pthread_pool_get_np ();
+ if (thread->threadid != l4_nilthread)
+ return 0;
+
#if 0
CORBA_Environment env;
diff --git a/sysdeps/l4/pt-thread-halt.c b/sysdeps/l4/pt-thread-halt.c
index ea97eea0..991123c2 100644
--- a/sysdeps/l4/pt-thread-halt.c
+++ b/sysdeps/l4/pt-thread-halt.c
@@ -1,5 +1,5 @@
-/* Deallocate the kernel thread resources. Mach version.
- Copyright (C) 2000,02 Free Software Foundation, Inc.
+/* Deallocate the kernel thread resources. L4version.
+ Copyright (C) 2000, 2002, 2004 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
@@ -26,6 +26,6 @@
void
__pthread_thread_halt (struct __pthread *thread)
{
- /* FIXME reuse thread somehow */
l4_stop (thread->threadid);
+ pthread_pool_add_np (thread->threadid);
}