mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-24 22:34:54 +02:00
Remove ATL (part two)
Use std::lock_guard instead of CComCritSecLock<CComAutoCriticalSection> Close #4320
This commit is contained in:
parent
ec5fa6d2c4
commit
3439071c3c
@ -26,6 +26,7 @@
|
||||
// http://qualapps.blogspot.com/2010/05/understanding-readdirectorychangesw.html
|
||||
// See ReadMe.txt for overview information.
|
||||
|
||||
#include <process.h>
|
||||
#include "ReadDirectoryChanges.h"
|
||||
#include "ReadDirectoryChangesPrivate.h"
|
||||
|
||||
|
@ -40,11 +40,6 @@
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
||||
|
||||
#include <atlbase.h>
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
// http://qualapps.blogspot.com/2010/05/understanding-readdirectorychangesw.html
|
||||
// See ReadMe.txt for overview information.
|
||||
|
||||
#include <shlwapi.h>
|
||||
#include "ReadDirectoryChanges.h"
|
||||
#include "ReadDirectoryChangesPrivate.h"
|
||||
|
||||
@ -152,7 +153,7 @@ void CReadChangesRequest::ProcessNotification()
|
||||
wstrFilename = m_wstrDirectory + wstrFilename;
|
||||
|
||||
// If it could be a short filename, expand it.
|
||||
LPCWSTR wszFilename = PathFindFileNameW(wstrFilename.c_str());
|
||||
LPCWSTR wszFilename = ::PathFindFileNameW(wstrFilename.c_str());
|
||||
int len = lstrlenW(wszFilename);
|
||||
// The maximum length of an 8.3 filename is twelve, including the dot.
|
||||
if (len <= 12 && wcschr(wszFilename, L'~'))
|
||||
|
@ -26,7 +26,10 @@
|
||||
// http://qualapps.blogspot.com/2010/05/understanding-readdirectorychangesw.html
|
||||
// See ReadMe.txt for overview information.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
|
||||
template <typename C>
|
||||
class CThreadSafeQueue : protected std::list<C>
|
||||
@ -53,7 +56,7 @@ public:
|
||||
void push(C& c)
|
||||
{
|
||||
{
|
||||
CComCritSecLock<CComAutoCriticalSection> lock(m_Crit, true);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
Base::push_back(c);
|
||||
}
|
||||
::SetEvent(m_hEvent);
|
||||
@ -61,7 +64,7 @@ public:
|
||||
|
||||
bool pop(C& c)
|
||||
{
|
||||
CComCritSecLock<CComAutoCriticalSection> lock( m_Crit, true );
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (Base::empty())
|
||||
{
|
||||
return false;
|
||||
@ -77,6 +80,5 @@ public:
|
||||
|
||||
protected:
|
||||
HANDLE m_hEvent;
|
||||
|
||||
CComAutoCriticalSection m_Crit;
|
||||
std::mutex m_mutex;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user