further fixes
authorAndy Wingo <wingo@pobox.com>
Tue, 22 Jan 2002 20:50:39 +0000 (20:50 +0000)
committerAndy Wingo <wingo@pobox.com>
Tue, 22 Jan 2002 20:50:39 +0000 (20:50 +0000)
Original commit message from CVS:
further fixes

gst/cothreads/Makefile.am
gst/cothreads/linuxthreads-internals.h
gst/cothreads/test-pth-pthreads.c

index 0203feb..cc40b95 100644 (file)
@@ -1,26 +1,3 @@
-##
-##  NGPT - Next Generation Threading
-##  Copyright (c) 2001 IBM Corporation <babt@us.ibm.com>
-##  Portions Copyright (c) 1999-2000 Ralf S. Engelschall <rse@engelschall.com>
-##
-##  This file is part of NGPT, a non-preemptive thread scheduling
-##  library which can be found at http://www.ibm.com/developer
-##
-##  This library is free software; you can redistribute it and/or
-##  modify it under the terms of the GNU Lesser General Public
-##  License as published by the Free Software Foundation; either
-##  version 2.1 of the License, or (at your option) any later version.
-##
-##  This 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
-##  Lesser General Public License for more details.
-##
-##  You should have received a copy of the GNU Lesser General Public
-##  License along with this library; if not, write to the Free Software
-##  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-##  USA.
-##
 ##  Makefile.am: NGPT Makefile.in hacked into an automake file by wingo
 ##  <wingo@pobox.com>
 ##
@@ -31,20 +8,19 @@ noinst_LTLIBRARIES = libpth-mctx.la
 
 libpth_mctx_la_SOURCES = pth_mctx.c pth_p.h pth_vers.c pth.h pth_acdef.h pth_acmac.h
 
-noinst_PROGRAMS = test-pth test-pth-pthreads
+noinst_PROGRAMS = test-pth test-pth-pthreads test-pthreads
 
 test_pth_LDADD = libpth-mctx.la
 test_pth_pthreads_LDADD = libpth-mctx.la -lpthread
-
-#pth_mctx_a_DEPENDENCIES = shtool
+test_pthreads_LDADD = -lpthread
 
 BUILT_SOURCES = pth_p.h
 
 HSRCS = $(srcdir)/pth_debug.c $(srcdir)/pth_errno.c $(srcdir)/pth_mctx.c
 
-#   build the private shared header file
 pth_p.h: $(srcdir)/pth_p.h.in $(HSRCS)
        $(srcdir)/shtool scpp -o pth_p.h -t $(srcdir)/pth_p.h.in -Dcpp -Cintern -M '==#==' $(HSRCS)
 
+#pth_mctx_a_DEPENDENCIES = shtool
 #shtool:
 #      shtoolize -o shtool scpp
index b70cc66..1126cc5 100644 (file)
@@ -1,22 +1,8 @@
-/* Linuxthreads - a simple clone()-based implementation of Posix        */
-/* threads for Linux.                                                   */
-/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr)              */
-/*                                                                      */
-/* This program 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.               */
-/*                                                                      */
-/* This program 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.                 */
-
+/* LinuxThreads internal data structures */
 /* hacked for use with gstreamer by andy wingo <wingo@pobox.com> */
 
-/* Internal data structures */
-
-#include <sys/types.h> /* _pthread_fastlock */
+#include <bits/local_lim.h> /* PTHREAD_THREADS_MAX */
+#include <sys/types.h>      /* _pthread_fastlock */
 
 typedef void * pthread_descr;
 
@@ -24,6 +10,7 @@ typedef void * pthread_descr;
    and retrieving the corresponding thread descriptor. Also used for
    mapping the available stack segments. */
 
+#pragma weak __pthread_handles
 extern struct pthread_handle_struct __pthread_handles[PTHREAD_THREADS_MAX];
 
 struct pthread_handle_struct {
index d18a4e7..f44845c 100644 (file)
@@ -34,8 +34,7 @@ void pthread (void* unused)
   printf ("1: %d\n", pthread_self());
   
   stackspace = malloc(2 * 1024 * 1024);
-  (pthread_descr) stackspace[2 * 1024 * 1024 - sizeof (pthread_descr) -1] = 
-    (thread_handle (pthread_self()))->h_descr;
+  memset (stackspace + 2 * 1024 * 1024 - sizeof(pthread_descr) - 1, &(thread_handle (pthread_self()))->h_descr, sizeof (pthread_descr));
   
   while (1) {
     skaddr = stackspace;