marcus256 wrote on Thursday, October 31, 2013:
I know that this is an old thread by now (I missed it), but I’ll give it a shot anyway. Perhaps it can clear up some things about the design philosophies in GLFW (old and new).
First of all, David, I’m sorry that you feel that way.
I guess I’m the one to blame for bringing the threading functionality into the 2.x line of GLFW in the first place, but here’s my reasoning (and I honestly don’t think that it’s insane)…
While threading support, including glfwSleep(), was an attempt att bringing cross-platform threading to the OpenGL development community back in the days when such solutions were not commonplace, I totally agree with the decision of dropping it in 3.x.
GLFW 3.x is, as has been told over and over, a move for simplification and re-adjustment to the current state and trends in the software & OpenGL development community, over a decade after GLFW first saw the light of day.
In particular, C11 and C++11 has finally brought proper, standardized threading libraries to us C & C++ developers, so there is really little point in keeping that in GLFW anymore.
If you look closely at those specifications, you’ll find that the Sleep functionality is part of the threading libraries: thrd_sleep() in <threads.h> (C11) and std::this_thread::sleep_for() in (C++11).
Now, since C11 and C++11 support was lacking a couple of years ago, I created TinyCThread and TinyThread++ for developers to use during the transitional period until compilers have caught up (because in my mind, the only sane way is to use standard libraries - and if you’re compiler is flawed, change compilers or work around it by using replacement libraries until it gets fixed).
I think that your particular problem is that you’re using the dreadful combination Visual Studio + C, which (as I understand it) has very poor support from Microsoft. They don’t seem to be interested in supporting anything newer than C90, other than subsets from newer C++ standards, which in my book reads “C is pretty low priority to us”.
My suggestion to anyone finding themselves in this unfortunate situation, rather than blaming GLFW for Microsofts poor C11 support, is to do some combination of the following:
A) If you want to stay with Visual Studio, perhaps move to C++ and reap the benefits of its C++11 support (yes, you can do std::this_thread::sleep_for() in VS 2012 and later).
B) If you want to stay with Visual Studio AND stay with its dated C support, start using TinyCThread and adopt the new standard way of doing threads in C11 (and no matter what you say - sleep() IS a threading function).
C) Nag on Microsoft to add support for C11 threads in Visual Studio (according to [1] I assume it’s only a matter of time, but they could probably do with some constructive user feedback).
[1] http://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/