mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-16 21:36:35 +00:00
44 lines
1.9 KiB
C
44 lines
1.9 KiB
C
|
/* 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];
|
||
|
}
|
||
|
|