Collect mutex and data protected by it in a single struct

Also use critical section instead of a mutex, as this is more efficient
under MSW.

Main purpose of this commit is to make it clear that this mutex/critical
section is only used together with the data from the same struct.

No real changes.
This commit is contained in:
Vadim Zeitlin
2021-01-10 20:42:38 +01:00
parent 7d1a7ef942
commit d88762d2f1
2 changed files with 13 additions and 8 deletions

View File

@@ -145,8 +145,13 @@ private:
wxMutex m_mutex;
wxCondition m_condition;
bool m_shuttingDown;
wxMutex m_cancelledMutex;
wxVector< wxObjectDataPtr<wxWebRequestCURL> > m_cancelledRequests;
// MT-safe vector of requests for which Cancel() was called.
struct CancelledData
{
wxCriticalSection cs;
wxVector< wxObjectDataPtr<wxWebRequestCURL> > requests;
} m_cancelled;
static int ms_activeSessions;