Clarified context TLS function names.

This commit is contained in:
Camilla Berglund 2015-05-05 03:31:20 +02:00
parent 6d5753c548
commit 38ca109766
8 changed files with 24 additions and 24 deletions

View File

@ -178,7 +178,7 @@ static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
// //
int _glfwInitContextAPI(void) int _glfwInitContextAPI(void)
{ {
if (!_glfwInitTLS()) if (!_glfwCreateContextTLS())
return GL_FALSE; return GL_FALSE;
_glfw.egl.display = eglGetDisplay((EGLNativeDisplayType)_GLFW_EGL_NATIVE_DISPLAY); _glfw.egl.display = eglGetDisplay((EGLNativeDisplayType)_GLFW_EGL_NATIVE_DISPLAY);
@ -210,7 +210,7 @@ void _glfwTerminateContextAPI(void)
{ {
eglTerminate(_glfw.egl.display); eglTerminate(_glfw.egl.display);
_glfwTerminateTLS(); _glfwDestroyContextTLS();
} }
#define setEGLattrib(attribName, attribValue) \ #define setEGLattrib(attribName, attribValue) \
@ -461,7 +461,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
} }
_glfwSetCurrentContext(window); _glfwSetContextTLS(window);
} }
void _glfwPlatformSwapBuffers(_GLFWwindow* window) void _glfwPlatformSwapBuffers(_GLFWwindow* window)

View File

@ -156,7 +156,7 @@ static GLXContext createLegacyContext(_GLFWwindow* window,
// //
int _glfwInitContextAPI(void) int _glfwInitContextAPI(void)
{ {
if (!_glfwInitTLS()) if (!_glfwCreateContextTLS())
return GL_FALSE; return GL_FALSE;
_glfw.glx.handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); _glfw.glx.handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
@ -260,7 +260,7 @@ void _glfwTerminateContextAPI(void)
_glfw.glx.handle = NULL; _glfw.glx.handle = NULL;
} }
_glfwTerminateTLS(); _glfwDestroyContextTLS();
} }
#define setGLXattrib(attribName, attribValue) \ #define setGLXattrib(attribName, attribValue) \
@ -477,7 +477,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
else else
glXMakeCurrent(_glfw.x11.display, None, NULL); glXMakeCurrent(_glfw.x11.display, None, NULL);
_glfwSetCurrentContext(window); _glfwSetContextTLS(window);
} }
void _glfwPlatformSwapBuffers(_GLFWwindow* window) void _glfwPlatformSwapBuffers(_GLFWwindow* window)

View File

@ -35,7 +35,7 @@
// //
int _glfwInitContextAPI(void) int _glfwInitContextAPI(void)
{ {
if (!_glfwInitTLS()) if (!_glfwCreateContextTLS())
return GL_FALSE; return GL_FALSE;
_glfw.nsgl.framework = _glfw.nsgl.framework =
@ -54,7 +54,7 @@ int _glfwInitContextAPI(void)
// //
void _glfwTerminateContextAPI(void) void _glfwTerminateContextAPI(void)
{ {
_glfwTerminateTLS(); _glfwDestroyContextTLS();
} }
// Create the OpenGL context // Create the OpenGL context
@ -257,7 +257,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
else else
[NSOpenGLContext clearCurrentContext]; [NSOpenGLContext clearCurrentContext];
_glfwSetCurrentContext(window); _glfwSetContextTLS(window);
} }
void _glfwPlatformSwapBuffers(_GLFWwindow* window) void _glfwPlatformSwapBuffers(_GLFWwindow* window)

View File

@ -32,7 +32,7 @@
////// GLFW internal API ////// ////// GLFW internal API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
int _glfwInitTLS(void) int _glfwCreateContextTLS(void)
{ {
if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0) if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0)
{ {
@ -44,12 +44,12 @@ int _glfwInitTLS(void)
return GL_TRUE; return GL_TRUE;
} }
void _glfwTerminateTLS(void) void _glfwDestroyContextTLS(void)
{ {
pthread_key_delete(_glfw.posix_tls.context); pthread_key_delete(_glfw.posix_tls.context);
} }
void _glfwSetCurrentContext(_GLFWwindow* context) void _glfwSetContextTLS(_GLFWwindow* context)
{ {
pthread_setspecific(_glfw.posix_tls.context, context); pthread_setspecific(_glfw.posix_tls.context, context);
} }

View File

@ -42,8 +42,8 @@ typedef struct _GLFWtlsPOSIX
} _GLFWtlsPOSIX; } _GLFWtlsPOSIX;
int _glfwInitTLS(void); int _glfCreateContextTLS(void);
void _glfwTerminateTLS(void); void _glfwDestroyContextTLS(void);
void _glfwSetCurrentContext(_GLFWwindow* context); void _glfwSetContextTLS(_GLFWwindow* context);
#endif // _posix_tls_h_ #endif // _posix_tls_h_

View File

@ -269,7 +269,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
// //
int _glfwInitContextAPI(void) int _glfwInitContextAPI(void)
{ {
if (!_glfwInitTLS()) if (!_glfwCreateContextTLS())
return GL_FALSE; return GL_FALSE;
_glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll"); _glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll");
@ -289,7 +289,7 @@ void _glfwTerminateContextAPI(void)
if (_glfw.wgl.opengl32.instance) if (_glfw.wgl.opengl32.instance)
FreeLibrary(_glfw.wgl.opengl32.instance); FreeLibrary(_glfw.wgl.opengl32.instance);
_glfwTerminateTLS(); _glfwDestroyContextTLS();
} }
#define setWGLattrib(attribName, attribValue) \ #define setWGLattrib(attribName, attribValue) \
@ -565,7 +565,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
else else
wglMakeCurrent(NULL, NULL); wglMakeCurrent(NULL, NULL);
_glfwSetCurrentContext(window); _glfwSetContextTLS(window);
} }
void _glfwPlatformSwapBuffers(_GLFWwindow* window) void _glfwPlatformSwapBuffers(_GLFWwindow* window)

View File

@ -32,7 +32,7 @@
////// GLFW internal API ////// ////// GLFW internal API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
int _glfwInitTLS(void) int _glfwCreateContextTLS(void)
{ {
_glfw.win32_tls.context = TlsAlloc(); _glfw.win32_tls.context = TlsAlloc();
if (_glfw.win32_tls.context == TLS_OUT_OF_INDEXES) if (_glfw.win32_tls.context == TLS_OUT_OF_INDEXES)
@ -46,13 +46,13 @@ int _glfwInitTLS(void)
return GL_TRUE; return GL_TRUE;
} }
void _glfwTerminateTLS(void) void _glfwDestroyContextTLS(void)
{ {
if (_glfw.win32_tls.allocated) if (_glfw.win32_tls.allocated)
TlsFree(_glfw.win32_tls.context); TlsFree(_glfw.win32_tls.context);
} }
void _glfwSetCurrentContext(_GLFWwindow* context) void _glfwSetContextTLS(_GLFWwindow* context)
{ {
TlsSetValue(_glfw.win32_tls.context, context); TlsSetValue(_glfw.win32_tls.context, context);
} }

View File

@ -41,8 +41,8 @@ typedef struct _GLFWtlsWin32
} _GLFWtlsWin32; } _GLFWtlsWin32;
int _glfwInitTLS(void); int _glfwCreateContextTLS(void);
void _glfwTerminateTLS(void); void _glfwDestroyContextTLS(void);
void _glfwSetCurrentContext(_GLFWwindow* context); void _glfwSetContextTLS(_GLFWwindow* context);
#endif // _win32_tls_h_ #endif // _win32_tls_h_