gstreamer/gst/cothreads/linuxthreads-internals.h
Andy Wingo 3c798cc8a0 i got it to work. i am the hack-master of the moment. check out test-pth-pthreads2.c.
Original commit message from CVS:
i got it to work. i am the hack-master of the moment. check out test-pth-pthreads2.c.
2002-01-23 03:14:19 +00:00

38 lines
1.2 KiB
C

/* LinuxThreads internal data structures */
/* hacked for use with gstreamer by andy wingo <wingo@pobox.com> */
#include <bits/local_lim.h> /* PTHREAD_THREADS_MAX */
#include <sys/types.h> /* _pthread_fastlock */
#ifndef CURRENT_STACK_FRAME
#define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
#endif /* CURRENT_STACK_FRAME */
#ifndef STACK_SIZE
#define STACK_SIZE 0x200000 /* 2 M linuxthreads default stack size */
#endif
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. */
#pragma weak __pthread_handles
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];
}