Add internal TLS support

Related to #970.
This commit is contained in:
Camilla Löwy
2017-03-08 13:58:09 +01:00
parent 62414bff6e
commit aaf2800c9c
19 changed files with 109 additions and 116 deletions
+2 -2
View File
@@ -192,7 +192,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
window->denom = GLFW_DONT_CARE;
// Save the currently current context so it can be restored later
previous = _glfwPlatformGetCurrentContext();
previous = _glfwPlatformGetTls(&_glfw.context);
if (ctxconfig.client != GLFW_NO_API)
glfwMakeContextCurrent(NULL);
@@ -408,7 +408,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow* handle)
// The window's context must not be current on another thread when the
// window is destroyed
if (window == _glfwPlatformGetCurrentContext())
if (window == _glfwPlatformGetTls(&_glfw.context))
glfwMakeContextCurrent(NULL);
_glfwPlatformDestroyWindow(window);