diff options
author | Brian Paul <[email protected]> | 2001-11-12 23:50:12 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-11-12 23:50:12 +0000 |
commit | 1b37d6c3055150fc5321e003bdca057a5b0daafa (patch) | |
tree | 3a3790ae5a82268f3d62d69335c71194a24458fe /src/mesa/glapi/glthread.h | |
parent | cd060fc3b44fb41629b5da640f10c3aa3e3c8cfd (diff) |
BeOS thread support (Philippe Houdoin)
Diffstat (limited to 'src/mesa/glapi/glthread.h')
-rw-r--r-- | src/mesa/glapi/glthread.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/mesa/glapi/glthread.h b/src/mesa/glapi/glthread.h index 639c46e427e..9ac51aef821 100644 --- a/src/mesa/glapi/glthread.h +++ b/src/mesa/glapi/glthread.h @@ -1,4 +1,4 @@ -/* $Id: glthread.h,v 1.8 2001/03/12 00:48:38 gareth Exp $ */ +/* $Id: glthread.h,v 1.9 2001/11/12 23:50:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -202,6 +202,39 @@ typedef xmutex_rec _glthread_Mutex; +/* + * BeOS threads. R5.x required. + */ +#ifdef BEOS_THREADS +#include <kernel/OS.h> +#include <support/TLS.h> + +typedef struct { + int32 key; + int initMagic; +} _glthread_TSD; + +typedef thread_id _glthread_Thread; + +/* Use Benaphore, aka speeder semaphore */ +typedef struct { + int32 lock; + sem_id sem; +} benaphore; +typedef benaphore _glthread_Mutex; + +#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, +create_sem(0, #name"_benaphore") } +#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, +#name"_benaphore"), name.lock = 0 +#define _glthread_LOCK_MUTEX(name) if((atomic_add(&(name.lock), 1)) >= 1) +acquire_sem(name.sem) +#define _glthread_UNLOCK_MUTEX(name) if((atomic_add(&(name.lock), -1)) > 1) +release_sem(name.sem) + +#endif /* BEOS_THREADS */ + + #ifndef THREADS |