summaryrefslogtreecommitdiff
path: root/src/gallium/include/pipe/p_thread.h
diff options
context:
space:
mode:
authorBenjamin Close <Benjamin.Close@clearchain.com>2009-02-24 20:51:10 -0800
committerBrian Paul <brianp@vmware.com>2009-02-25 07:56:43 -0700
commitdbab39c6caacb974062ac574b365254412aea412 (patch)
tree78503019f2b6c4095fc14160f133551ddc999d74 /src/gallium/include/pipe/p_thread.h
parentafe139f629251f38afd5b477d5b00f47d17da60f (diff)
gallium: Add support for BSD operating systems, tested with FreeBSD
BSD supports pipe in the same way as linux hence options which are safe for linux are also safe for BSD. Define PIPE_OS_BSD in include/pipe/p_config.h and adjust the defines to make use of it. Also define MAP_ANONYMOUS for BSD systems which use MAP_ANON Signed-off-by: Benjamin Close <Benjamin.Close@clearchain.com>
Diffstat (limited to 'src/gallium/include/pipe/p_thread.h')
-rw-r--r--src/gallium/include/pipe/p_thread.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h
index 8af3cd958b..e59b999b9a 100644
--- a/src/gallium/include/pipe/p_thread.h
+++ b/src/gallium/include/pipe/p_thread.h
@@ -38,7 +38,7 @@
#include "pipe/p_compiler.h"
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
#include <pthread.h> /* POSIX threads headers */
#include <stdio.h> /* for perror() */
@@ -210,7 +210,7 @@ typedef unsigned pipe_condvar;
*/
typedef struct {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
pthread_key_t key;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
DWORD key;
@@ -225,7 +225,7 @@ typedef struct {
static INLINE void
pipe_tsd_init(pipe_tsd *tsd)
{
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
perror("pthread_key_create(): failed to allocate key for thread specific data");
exit(-1);
@@ -242,7 +242,7 @@ pipe_tsd_get(pipe_tsd *tsd)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
return pthread_getspecific(tsd->key);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
assert(0);
@@ -259,7 +259,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
if (pthread_setspecific(tsd->key, value) != 0) {
perror("pthread_set_specific() failed");
exit(-1);