Split out TLS code into separate modules.

This allows the TLS code to be re-used by partial ports like EGL.
This commit is contained in:
Camilla Berglund
2014-03-30 14:37:20 +02:00
parent 2889f484f4
commit 78efc18079
16 changed files with 278 additions and 88 deletions
+5 -14
View File
@@ -165,6 +165,9 @@ static GLXContext createLegacyContext(_GLFWwindow* window,
//
int _glfwInitContextAPI(void)
{
if (!_glfwInitTLS())
return GL_FALSE;
#ifdef _GLFW_DLOPEN_LIBGL
_glfw.glx.libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
if (!_glfw.glx.libGL)
@@ -174,13 +177,6 @@ int _glfwInitContextAPI(void)
}
#endif
if (pthread_key_create(&_glfw.glx.current, NULL) != 0)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"GLX: Failed to create context TLS");
return GL_FALSE;
}
if (!glXQueryExtension(_glfw.x11.display,
&_glfw.glx.errorBase,
&_glfw.glx.eventBase))
@@ -272,7 +268,7 @@ void _glfwTerminateContextAPI(void)
}
#endif
pthread_key_delete(_glfw.glx.current);
_glfwTerminateTLS();
}
#define setGLXattrib(attribName, attribValue) \
@@ -478,12 +474,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
else
glXMakeCurrent(_glfw.x11.display, None, NULL);
pthread_setspecific(_glfw.glx.current, window);
}
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
{
return (_GLFWwindow*) pthread_getspecific(_glfw.glx.current);
_glfwSetCurrentContext(window);
}
void _glfwPlatformSwapBuffers(_GLFWwindow* window)