MCPcopy Create free account
hub / github.com/cginternals/glbinding / startWriter

Function startWriter

source/glbinding-aux/source/logging.cpp:169–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void startWriter(const std::string & filepath)
170{
171 g_stop = false;
172 g_persisted = false;
173
174 std_boost::thread writer([filepath]()
175 {
176 const auto key = g_buffer.addTail();
177 std::ofstream logfile;
178 logfile.open (filepath, std::ios::out);
179
180 while (!g_stop || (g_buffer.size(key) != 0))
181 {
182 auto i = g_buffer.cbegin(key);
183
184 while (g_buffer.valid(key, i))
185 {
186 logfile << *i;
187 i = g_buffer.next(key, i);
188 }
189
190 logfile.flush();
191
192 std_boost::this_thread::sleep_for(std_boost::chrono::milliseconds(1));
193 }
194
195 logfile.close();
196 g_buffer.removeTail(key);
197 g_persisted = true;
198 g_finishcheck.notify_all();
199 });
200
201 writer.detach();
202}
203
204const std::string getStandardFilepath()
205{

Callers 2

startFunction · 0.85
startExceptFunction · 0.85

Calls 2

sizeMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected