[glfw] Atomic is no longer needed

All View events come from the same thread.
This commit is contained in:
Thiago Marcos P. Santos
2016-04-28 16:03:45 +03:00
parent 72f351c153
commit 94093493d5
2 changed files with 4 additions and 7 deletions

View File

@@ -11,8 +11,6 @@
#define GL_GLEXT_PROTOTYPES
#include <GLFW/glfw3.h>
#include <atomic>
class GLFWView : public mbgl::View {
public:
GLFWView(bool fullscreen = false, bool benchmark = false);
@@ -95,7 +93,7 @@ private:
mbgl::util::Timer frameTick;
GLFWwindow *window = nullptr;
std::atomic_flag clean = ATOMIC_FLAG_INIT;
bool dirty = false;
};
#endif

View File

@@ -417,15 +417,12 @@ void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) {
void GLFWView::run() {
auto callback = [&] {
if (glfwWindowShouldClose(window)) {
frameTick.stop();
runLoop.stop();
return;
}
glfwPollEvents();
const bool dirty = !clean.test_and_set();
if (dirty) {
const double started = glfwGetTime();
@@ -444,6 +441,8 @@ void GLFWView::run() {
if (benchmark) {
map->update(mbgl::Update::Repaint);
}
dirty = false;
}
};
@@ -476,7 +475,7 @@ void GLFWView::deactivate() {
}
void GLFWView::invalidate() {
clean.clear();
dirty = true;
glfwPostEmptyEvent();
}