2002-01-22 20:50:39 +00:00
|
|
|
/* LinuxThreads internal data structures */
|
2002-01-22 01:32:49 +00:00
|
|
|
/* hacked for use with gstreamer by andy wingo <wingo@pobox.com> */
|
|
|
|
|
2002-01-22 20:50:39 +00:00
|
|
|
#include <bits/local_lim.h> /* PTHREAD_THREADS_MAX */
|
|
|
|
#include <sys/types.h> /* _pthread_fastlock */
|
2002-01-22 01:32:49 +00:00
|
|
|
|
2002-01-22 21:41:14 +00:00
|
|
|
#ifndef CURRENT_STACK_FRAME
|
|
|
|
#define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
|
|
|
|
#endif /* CURRENT_STACK_FRAME */
|
|
|
|
|
|
|
|
#ifndef STACK_SIZE
|
2002-01-23 03:14:19 +00:00
|
|
|
#define STACK_SIZE 0x200000 /* 2 M linuxthreads default stack size */
|
2002-01-22 21:41:14 +00:00
|
|
|
#endif
|
|
|
|
|
2002-01-22 01:32:49 +00:00
|
|
|
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. */
|
|
|
|
|
2002-01-22 20:50:39 +00:00
|
|
|
#pragma weak __pthread_handles
|
2002-01-22 01:32:49 +00:00
|
|
|
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];
|
|
|
|
}
|
|
|
|
|