forked from StephanTLavavej/mingw-distro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglbinding.patch
112 lines (94 loc) · 3.45 KB
/
glbinding.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
diff -aurN glbinding-2.0.0/source/glbinding/source/Binding.cpp glbinding-2.0.0-fixed/source/glbinding/source/Binding.cpp
--- glbinding-2.0.0/source/glbinding/source/Binding.cpp 2016-03-24 10:15:07.000000000 -0700
+++ glbinding-2.0.0-fixed/source/glbinding/source/Binding.cpp 2016-04-25 20:50:24.191675500 -0700
@@ -2,7 +2,15 @@
#include <glbinding/Binding.h>
#include <unordered_map>
+
+#ifdef GLBINDING_USE_BOOST_THREAD
+#include <boost/thread.hpp>
+namespace std_boost = boost;
+#else
#include <mutex>
+namespace std_boost = std;
+#endif
+
#include <cassert>
#include "glbinding/glbinding_features.h"
@@ -13,7 +21,7 @@
GLBINDING_THREAD_LOCAL glbinding::ContextHandle t_context = 0;
-std::recursive_mutex g_mutex;
+std_boost::recursive_mutex g_mutex;
std::unordered_map<glbinding::ContextHandle, int> g_bindings;
} // namespace
diff -aurN glbinding-2.0.0/source/glbinding/source/logging.cpp glbinding-2.0.0-fixed/source/glbinding/source/logging.cpp
--- glbinding-2.0.0/source/glbinding/source/logging.cpp 2016-03-24 10:15:07.000000000 -0700
+++ glbinding-2.0.0-fixed/source/glbinding/source/logging.cpp 2016-04-25 21:04:33.780329900 -0700
@@ -3,11 +3,20 @@
#include <array>
#include <atomic>
-#include <condition_variable>
+#include <chrono>
#include <fstream>
-#include <mutex>
#include <sstream>
+
+#ifdef GLBINDING_USE_BOOST_THREAD
+#include <boost/chrono.hpp>
+#include <boost/thread.hpp>
+namespace std_boost = boost;
+#else
+#include <condition_variable>
+#include <mutex>
#include <thread>
+namespace std_boost = std;
+#endif
#include "logging_private.h"
#include "RingBuffer.h"
@@ -20,8 +29,8 @@
std::atomic<bool> g_stop{false};
std::atomic<bool> g_persisted{false};
-std::mutex g_lockfinish;
-std::condition_variable g_finishcheck;
+std_boost::mutex g_lockfinish;
+std_boost::condition_variable g_finishcheck;
using FunctionCallBuffer = glbinding::RingBuffer<glbinding::logging::LogEntry>;
FunctionCallBuffer g_buffer{LOG_BUFFER_SIZE};
@@ -74,7 +83,7 @@
removeCallbackMask(CallbackMask::Logging);
g_stop = true;
- std::unique_lock<std::mutex> locker(g_lockfinish);
+ std_boost::unique_lock<std_boost::mutex> locker(g_lockfinish);
// Spurious wake-ups: http://www.codeproject.com/Articles/598695/Cplusplus-threads-locks-and-condition-variables
while(!g_persisted)
@@ -100,7 +109,7 @@
while (!available)
{
- std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ std_boost::this_thread::sleep_for(std_boost::chrono::milliseconds(1));
next = g_buffer.nextHead(available);
}
@@ -115,7 +124,7 @@
g_stop = false;
g_persisted = false;
- std::thread writer([filepath]()
+ std_boost::thread writer([filepath]()
{
const auto key = g_buffer.addTail();
std::ofstream logfile;
@@ -133,7 +142,7 @@
logfile.flush();
- std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ std_boost::this_thread::sleep_for(std_boost::chrono::milliseconds(1));
}
logfile.close();
diff -aurN glbinding-2.0.0/source/glbinding/source/RingBuffer.hpp glbinding-2.0.0-fixed/source/glbinding/source/RingBuffer.hpp
--- glbinding-2.0.0/source/glbinding/source/RingBuffer.hpp 2016-03-24 10:15:07.000000000 -0700
+++ glbinding-2.0.0-fixed/source/glbinding/source/RingBuffer.hpp 2016-04-25 21:22:53.179803600 -0700
@@ -2,7 +2,6 @@
#pragma once
#include <iomanip>
-#include <thread>
#include <iterator>
#include <cassert>
#include <cmath>