forgot to add a file
authorAndy Wingo <wingo@pobox.com>
Tue, 22 Jan 2002 01:32:49 +0000 (01:32 +0000)
committerAndy Wingo <wingo@pobox.com>
Tue, 22 Jan 2002 01:32:49 +0000 (01:32 +0000)
Original commit message from CVS:
forgot to add a file

gst/cothreads/linuxthreads-internals.h [new file with mode: 0644]

diff --git a/gst/cothreads/linuxthreads-internals.h b/gst/cothreads/linuxthreads-internals.h
new file mode 100644 (file)
index 0000000..b70cc66
--- /dev/null
@@ -0,0 +1,43 @@
+/* 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.                 */
+
+/* hacked for use with gstreamer by andy wingo <wingo@pobox.com> */
+
+/* Internal data structures */
+
+#include <sys/types.h> /* _pthread_fastlock */
+
+typedef void * pthread_descr;
+
+/* Global array of thread handles, used for validating a thread id
+   and retrieving the corresponding thread descriptor. Also used for
+   mapping the available stack segments. */
+
+extern struct pthread_handle_struct __pthread_handles[PTHREAD_THREADS_MAX];
+
+struct pthread_handle_struct {
+  struct _pthread_fastlock h_lock; /* Fast lock for sychronized access */
+  pthread_descr h_descr;        /* Thread descriptor or NULL if invalid */
+  char * h_bottom;              /* Lowest address in the stack thread */
+};
+
+typedef struct pthread_handle_struct * pthread_handle;
+
+/* Return the handle corresponding to a thread id */
+
+static inline pthread_handle thread_handle(pthread_t id)
+{
+  return &__pthread_handles[id % PTHREAD_THREADS_MAX];
+}
+