Confined remaining functions to main thread.

This commit is contained in:
Camilla Berglund 2014-03-24 11:58:35 +01:00
parent a9c7377e0a
commit 0e20577af4

View File

@ -1001,6 +1001,8 @@ GLFWAPI const char* glfwGetVersionString(void);
*
* @remarks This function may be called before @ref glfwInit.
*
* @note This function may only be called from the main thread.
*
* @note The error callback is called by the thread where the error was
* generated. If you are using GLFW from multiple threads, your error callback
* needs to be written accordingly.
@ -1023,6 +1025,8 @@ GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
* set to zero if an error occurred.
* @return An array of monitor handles, or `NULL` if an error occurred.
*
* @note This function may only be called from the main thread.
*
* @note The returned array is allocated and freed by GLFW. You should not
* free it yourself.
*
@ -1043,6 +1047,8 @@ GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
*
* @return The primary monitor, or `NULL` if an error occurred.
*
* @note This function may only be called from the main thread.
*
* @sa glfwGetMonitors
*
* @ingroup monitor
@ -1058,6 +1064,8 @@ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
* @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
* @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
*
* @note This function may only be called from the main thread.
*
* @ingroup monitor
*/
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
@ -1073,6 +1081,8 @@ GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
* @param[out] height Where to store the height, in mm, of the monitor's
* display area, or `NULL`.
*
* @note This function may only be called from the main thread.
*
* @note Some operating systems do not provide accurate information, either
* because the monitor's EDID data is incorrect, or because the driver does not
* report it accurately.
@ -1090,6 +1100,8 @@ GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* h
* @return The UTF-8 encoded name of the monitor, or `NULL` if an error
* occurred.
*
* @note This function may only be called from the main thread.
*
* @note The returned string is allocated and freed by GLFW. You should not
* free it yourself.
*
@ -1108,6 +1120,8 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @bug **X11:** This callback is not yet called on monitor configuration
* changes.
*
@ -1127,6 +1141,8 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
* array. This is set to zero if an error occurred.
* @return An array of video modes, or `NULL` if an error occurred.
*
* @note This function may only be called from the main thread.
*
* @note The returned array is allocated and freed by GLFW. You should not
* free it yourself.
*
@ -1148,6 +1164,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
* @param[in] monitor The monitor to query.
* @return The current mode of the monitor, or `NULL` if an error occurred.
*
* @note This function may only be called from the main thread.
*
* @note The returned struct is allocated and freed by GLFW. You should not
* free it yourself.
*
@ -1165,6 +1183,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
* @param[in] monitor The monitor whose gamma ramp to set.
* @param[in] gamma The desired exponent.
*
* @note This function may only be called from the main thread.
*
* @ingroup monitor
*/
GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
@ -1176,6 +1196,8 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
* @param[in] monitor The monitor to query.
* @return The current gamma ramp, or `NULL` if an error occurred.
*
* @note This function may only be called from the main thread.
*
* @note The value arrays of the returned ramp are allocated and freed by GLFW.
* You should not free them yourself.
*
@ -1190,6 +1212,8 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
* @param[in] monitor The monitor whose gamma ramp to set.
* @param[in] ramp The gamma ramp to use.
*
* @note This function may only be called from the main thread.
*
* @note Gamma ramp sizes other than 256 are not supported by all hardware.
*
* @ingroup monitor
@ -1374,6 +1398,8 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
* @param[out] ypos Where to store the y-coordinate of the upper-left corner of
* the client area, or `NULL`.
*
* @note This function may only be called from the main thread.
*
* @sa glfwSetWindowPos
*
* @ingroup window
@ -1420,6 +1446,8 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
* @param[out] height Where to store the height, in screen coordinates, of the
* client area, or `NULL`.
*
* @note This function may only be called from the main thread.
*
* @sa glfwSetWindowSize
*
* @ingroup window
@ -1462,6 +1490,8 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
* @param[out] height Where to store the height, in pixels, of the framebuffer,
* or `NULL`.
*
* @note This function may only be called from the main thread.
*
* @sa glfwSetFramebufferSizeCallback
*
* @ingroup window
@ -1542,6 +1572,8 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window);
* @param[in] window The window to query.
* @return The monitor, or `NULL` if the window is in windowed mode.
*
* @note This function may only be called from the main thread.
*
* @ingroup window
*/
GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
@ -1556,6 +1588,8 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
* return.
* @return The value of the attribute, or zero if an error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup window
*/
GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
@ -1569,6 +1603,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
* @param[in] window The window whose pointer to set.
* @param[in] pointer The new value.
*
* @remarks This function may be called from any thread.
*
* @sa glfwGetWindowUserPointer
*
* @ingroup window
@ -1582,6 +1618,8 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
*
* @param[in] window The window whose pointer to return.
*
* @remarks This function may be called from any thread.
*
* @sa glfwSetWindowUserPointer
*
* @ingroup window
@ -1600,6 +1638,8 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup window
*/
GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
@ -1616,6 +1656,8 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindow
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup window
*/
GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
@ -1643,6 +1685,8 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
* @remarks **OS X:** Selecting Quit from the application menu will
* trigger the close callback for all windows.
*
* @note This function may only be called from the main thread.
*
* @ingroup window
*/
GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
@ -1663,6 +1707,8 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwi
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @note On compositing window systems such as Aero, Compiz or Aqua, where the
* window contents are saved off-screen, this callback may be called only very
* infrequently or never at all.
@ -1687,6 +1733,8 @@ GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GL
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup window
*/
GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
@ -1702,6 +1750,8 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup window
*/
GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
@ -1717,6 +1767,8 @@ GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GL
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup window
*/
GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
@ -1812,6 +1864,8 @@ GLFWAPI void glfwPostEmptyEvent(void);
* @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
* `GLFW_STICKY_MOUSE_BUTTONS`.
*
* @note This function may only be called from the main thread.
*
* @sa glfwSetInputMode
*
* @ingroup input
@ -1850,6 +1904,8 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
* you are only interested in whether mouse buttons have been pressed but not
* when or in which order.
*
* @note This function may only be called from the main thread.
*
* @sa glfwGetInputMode
*
* @ingroup input
@ -1876,6 +1932,8 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
* @param[in] key The desired [keyboard key](@ref keys).
* @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
*
* @note This function may only be called from the main thread.
*
* @note `GLFW_KEY_UNKNOWN` is not a valid key for this function.
*
* @ingroup input
@ -1896,6 +1954,8 @@ GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
* @param[in] button The desired [mouse button](@ref buttons).
* @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
@ -1921,6 +1981,8 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
* @param[out] ypos Where to store the cursor y-coordinate, relative to the to
* top edge of the client area, or `NULL`.
*
* @note This function may only be called from the main thread.
*
* @sa glfwSetCursorPos
*
* @ingroup input
@ -1945,6 +2007,8 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
* @param[in] ypos The desired y-coordinate, relative to the top edge of the
* client area.
*
* @note This function may only be called from the main thread.
*
* @sa glfwGetCursorPos
*
* @ingroup input
@ -1987,6 +2051,8 @@ GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
* @param[in] cursor The cursor to change to, or `NULL` to switch back to the
* default system cursor.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
@ -2021,6 +2087,8 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
@ -2040,6 +2108,8 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
@ -2061,6 +2131,8 @@ GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
@ -2078,6 +2150,8 @@ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmo
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
@ -2094,6 +2168,8 @@ GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursor
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
@ -2113,6 +2189,8 @@ GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcu
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
@ -2129,6 +2207,8 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cb
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
@ -2140,6 +2220,8 @@ GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
* @param[in] joy The joystick to query.
* @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.
*
* @note This function may only be called from the main thread.
*
* @ingroup input
*/
GLFWAPI int glfwJoystickPresent(int joy);
@ -2153,6 +2235,8 @@ GLFWAPI int glfwJoystickPresent(int joy);
* set to zero if an error occurred.
* @return An array of axis values, or `NULL` if the joystick is not present.
*
* @note This function may only be called from the main thread.
*
* @note The returned array is allocated and freed by GLFW. You should not
* free it yourself.
*
@ -2172,6 +2256,8 @@ GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
* set to zero if an error occurred.
* @return An array of button states, or `NULL` if the joystick is not present.
*
* @note This function may only be called from the main thread.
*
* @note The returned array is allocated and freed by GLFW. You should not
* free it yourself.
*
@ -2190,6 +2276,8 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
* @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
* is not present.
*
* @note This function may only be called from the main thread.
*
* @note The returned string is allocated and freed by GLFW. You should not
* free it yourself.
*
@ -2265,6 +2353,8 @@ GLFWAPI double glfwGetTime(void);
*
* @param[in] time The new value, in seconds.
*
* @note This function may only be called from the main thread.
*
* @note The resolution of the timer is system dependent, but is usually on the
* order of a few micro- or nanoseconds. It uses the highest-resolution
* monotonic time source on each supported platform.
@ -2315,12 +2405,12 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
*
* @param[in] window The window whose buffers to swap.
*
* @remarks This function may be called from any thread.
*
* @par New in GLFW 3
* This function no longer calls @ref glfwPollEvents. You need to call it or
* @ref glfwWaitEvents yourself.
*
* @remarks This function may be called from any thread.
*
* @sa glfwSwapInterval
*
* @ingroup context