@@ -196,6 +196,8 @@ srt::CUDTUnited::CUDTUnited():
196
196
// XXX An unlikely exception thrown from the below calls
197
197
// might destroy the application before `main`. This shouldn't
198
198
// be a problem in general.
199
+
setupMutex(m_GCStopLock, "GCStop");
200
+
setupCond(m_GCStopCond, "GCStop");
199
201
setupMutex(m_GlobControlLock, "GlobControl");
200
202
setupMutex(m_IDLock, "ID");
201
203
setupMutex(m_InitLock, "Init");
@@ -216,6 +218,16 @@ srt::CUDTUnited::~CUDTUnited()
216
218
releaseMutex(m_GlobControlLock);
217
219
releaseMutex(m_IDLock);
218
220
releaseMutex(m_InitLock);
221
+
// XXX There's some weird bug here causing this
222
+
// to hangup on Windows. This might be either something
223
+
// bigger, or some problem in pthread-win32. As this is
224
+
// the application cleanup section, this can be temporarily
225
+
// tolerated with simply exit the application without cleanup,
226
+
// counting on that the system will take care of it anyway.
227
+
#ifndef _WIN32
228
+
releaseCond(m_GCStopCond);
229
+
#endif
230
+
releaseMutex(m_GCStopLock);
219
231
220
232
delete m_pCache;
221
233
}
@@ -254,15 +266,6 @@ int srt::CUDTUnited::startup()
254
266
255
267
m_bClosing = false;
256
268
257
-
try
258
-
{
259
-
setupMutex(m_GCStopLock, "GCStop");
260
-
setupCond(m_GCStopCond, "GCStop");
261
-
}
262
-
catch (...)
263
-
{
264
-
return -1;
265
-
}
266
269
if (!StartThread(m_GCThread, garbageCollect, this, "SRT:GC"))
267
270
return -1;
268
271
@@ -291,7 +294,10 @@ int srt::CUDTUnited::cleanup()
291
294
if (!m_bGCStatus)
292
295
return 0;
293
296
294
-
m_bClosing = true;
297
+
{
298
+
UniqueLock gclock(m_GCStopLock);
299
+
m_bClosing = true;
300
+
}
295
301
// NOTE: we can do relaxed signaling here because
296
302
// waiting on m_GCStopCond has a 1-second timeout,
297
303
// after which the m_bClosing flag is cheched, which
@@ -300,16 +306,6 @@ int srt::CUDTUnited::cleanup()
300
306
CSync::signal_relaxed(m_GCStopCond);
301
307
m_GCThread.join();
302
308
303
-
// XXX There's some weird bug here causing this
304
-
// to hangup on Windows. This might be either something
305
-
// bigger, or some problem in pthread-win32. As this is
306
-
// the application cleanup section, this can be temporarily
307
-
// tolerated with simply exit the application without cleanup,
308
-
// counting on that the system will take care of it anyway.
309
-
#ifndef _WIN32
310
-
releaseCond(m_GCStopCond);
311
-
#endif
312
-
313
309
m_bGCStatus = false;
314
310
315
311
// Global destruction code
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4