mapi: remove u_thread.h
Just use c11 threads directly. Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
@@ -18,8 +18,7 @@ MAPI_UTIL_FILES = \
|
|||||||
u_current.c \
|
u_current.c \
|
||||||
u_current.h \
|
u_current.h \
|
||||||
u_execmem.c \
|
u_execmem.c \
|
||||||
u_execmem.h \
|
u_execmem.h
|
||||||
u_thread.h
|
|
||||||
|
|
||||||
MAPI_BRIDGE_FILES = \
|
MAPI_BRIDGE_FILES = \
|
||||||
entry.c \
|
entry.c \
|
||||||
|
@@ -45,7 +45,6 @@
|
|||||||
#define _GLAPI_H
|
#define _GLAPI_H
|
||||||
|
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
#include "u_thread.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "u_current.h"
|
#include "u_current.h"
|
||||||
#include "u_thread.h"
|
|
||||||
#include "mapi.h"
|
#include "mapi.h"
|
||||||
#include "stub.h"
|
#include "stub.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
|
@@ -28,10 +28,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include "c11/threads.h"
|
||||||
|
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
#include "u_current.h"
|
#include "u_current.h"
|
||||||
#include "u_thread.h"
|
|
||||||
#include "entry.h"
|
#include "entry.h"
|
||||||
#include "stub.h"
|
#include "stub.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
@@ -54,16 +54,8 @@ static int next_dynamic_slot = MAPI_TABLE_NUM_STATIC;
|
|||||||
void
|
void
|
||||||
stub_init_once(void)
|
stub_init_once(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PTHREAD
|
static once_flag flag = ONCE_FLAG_INIT;
|
||||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
call_once(&flag, entry_patch_public);
|
||||||
pthread_once(&once, entry_patch_public);
|
|
||||||
#else
|
|
||||||
static int first = 1;
|
|
||||||
if (first) {
|
|
||||||
first = 0;
|
|
||||||
entry_patch_public();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@@ -48,8 +48,8 @@
|
|||||||
* drivers! No changes to the public glapi interface.
|
* drivers! No changes to the public glapi interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "c11/threads.h"
|
||||||
#include "u_current.h"
|
#include "u_current.h"
|
||||||
#include "u_thread.h"
|
|
||||||
|
|
||||||
#ifndef MAPI_MODE_UTIL
|
#ifndef MAPI_MODE_UTIL
|
||||||
|
|
||||||
@@ -112,8 +112,8 @@ struct mapi_table *u_current_table =
|
|||||||
(struct mapi_table *) table_noop_array;
|
(struct mapi_table *) table_noop_array;
|
||||||
void *u_current_context;
|
void *u_current_context;
|
||||||
|
|
||||||
struct u_tsd u_current_table_tsd;
|
tss_t u_current_table_tsd;
|
||||||
static struct u_tsd u_current_context_tsd;
|
static tss_t u_current_context_tsd;
|
||||||
static int ThreadSafe;
|
static int ThreadSafe;
|
||||||
|
|
||||||
#endif /* defined(GLX_USE_TLS) */
|
#endif /* defined(GLX_USE_TLS) */
|
||||||
@@ -124,8 +124,8 @@ void
|
|||||||
u_current_destroy(void)
|
u_current_destroy(void)
|
||||||
{
|
{
|
||||||
#if !defined(GLX_USE_TLS)
|
#if !defined(GLX_USE_TLS)
|
||||||
u_tsd_destroy(&u_current_table_tsd);
|
tss_delete(u_current_table_tsd);
|
||||||
u_tsd_destroy(&u_current_context_tsd);
|
tss_delete(u_current_context_tsd);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,8 +135,8 @@ u_current_destroy(void)
|
|||||||
static void
|
static void
|
||||||
u_current_init_tsd(void)
|
u_current_init_tsd(void)
|
||||||
{
|
{
|
||||||
u_tsd_init(&u_current_table_tsd);
|
tss_create(&u_current_table_tsd, NULL);
|
||||||
u_tsd_init(&u_current_context_tsd);
|
tss_create(&u_current_context_tsd, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,7 +233,7 @@ u_current_set_context(const void *ptr)
|
|||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
u_current_context = (void *) ptr;
|
u_current_context = (void *) ptr;
|
||||||
#else
|
#else
|
||||||
u_tsd_set(&u_current_context_tsd, (void *) ptr);
|
tss_set(u_current_context_tsd, (void *) ptr);
|
||||||
u_current_context = (ThreadSafe) ? NULL : (void *) ptr;
|
u_current_context = (ThreadSafe) ? NULL : (void *) ptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -249,9 +249,7 @@ u_current_get_context_internal(void)
|
|||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
return u_current_context;
|
return u_current_context;
|
||||||
#else
|
#else
|
||||||
return (ThreadSafe)
|
return ThreadSafe ? tss_get(u_current_context_tsd) : u_current_context;
|
||||||
? u_tsd_get(&u_current_context_tsd)
|
|
||||||
: u_current_context;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +271,7 @@ u_current_set_table(const struct mapi_table *tbl)
|
|||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
u_current_table = (struct mapi_table *) tbl;
|
u_current_table = (struct mapi_table *) tbl;
|
||||||
#else
|
#else
|
||||||
u_tsd_set(&u_current_table_tsd, (void *) tbl);
|
tss_set(u_current_table_tsd, (void *) tbl);
|
||||||
u_current_table = (ThreadSafe) ? NULL : (void *) tbl;
|
u_current_table = (ThreadSafe) ? NULL : (void *) tbl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -287,7 +285,9 @@ u_current_get_table_internal(void)
|
|||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
return u_current_table;
|
return u_current_table;
|
||||||
#else
|
#else
|
||||||
return (struct mapi_table *) ((ThreadSafe) ?
|
if (ThreadSafe)
|
||||||
u_tsd_get(&u_current_table_tsd) : (void *) u_current_table);
|
return (struct mapi_table *) tss_get(u_current_table_tsd);
|
||||||
|
else
|
||||||
|
return (struct mapi_table *) u_current_table;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "c99_compat.h"
|
#include "c99_compat.h"
|
||||||
#include "u_thread.h"
|
#include "c11/threads.h"
|
||||||
#include "u_execmem.h"
|
#include "u_execmem.h"
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user