parent
3439071c3c
commit
581aff630a
@ -1,48 +0,0 @@
|
||||
// This file is part of Notepad++ project
|
||||
// Copyright (C)2003 Don HO <don.h@free.fr>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Note that the GPL places important restrictions on "derived works", yet
|
||||
// it does not provide a detailed definition of that term. To avoid
|
||||
// misunderstandings, we consider an application to constitute a
|
||||
// "derivative work" for the purpose of this license if it does any of the
|
||||
// following:
|
||||
// 1. Integrates source code from Notepad++.
|
||||
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
|
||||
// installer, such as those produced by InstallShield.
|
||||
// 3. Links to a library or executes a program that does any of the above.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
#include "LongRunningOperation.h"
|
||||
#include "mutex.h"
|
||||
|
||||
using namespace Yuni;
|
||||
|
||||
|
||||
|
||||
|
||||
LongRunningOperation::LongRunningOperation()
|
||||
{
|
||||
Mutex::ClassLevelLockable<LongRunningOperation>::mutex.lock();
|
||||
}
|
||||
|
||||
|
||||
LongRunningOperation::~LongRunningOperation()
|
||||
{
|
||||
Mutex::ClassLevelLockable<LongRunningOperation>::mutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
// This file is part of Notepad++ project
|
||||
// Copyright (C)2003 Don HO <don.h@free.fr>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Note that the GPL places important restrictions on "derived works", yet
|
||||
// it does not provide a detailed definition of that term. To avoid
|
||||
// misunderstandings, we consider an application to constitute a
|
||||
// "derivative work" for the purpose of this license if it does any of the
|
||||
// following:
|
||||
// 1. Integrates source code from Notepad++.
|
||||
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
|
||||
// installer, such as those produced by InstallShield.
|
||||
// 3. Links to a library or executes a program that does any of the above.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
#ifndef M30_IDE_LONGRUNNINGOPERATION_h
|
||||
#define M30_IDE_LONGRUNNINGOPERATION_h
|
||||
|
||||
class LongRunningOperation
|
||||
{
|
||||
public:
|
||||
LongRunningOperation();
|
||||
~LongRunningOperation();
|
||||
};
|
||||
|
||||
#endif //M30_IDE_LONGRUNNINGOPERATION_h
|
@ -1,181 +0,0 @@
|
||||
// YUNI's default license is the GNU Lesser Public License (LGPL), with some
|
||||
// exclusions (see below). This basically means that you can get the full source
|
||||
// code for nothing, so long as you adhere to a few rules.
|
||||
//
|
||||
// Under the LGPL you may use YUNI for any purpose you wish, and modify it if you
|
||||
// require, as long as you:
|
||||
//
|
||||
// Pass on the (modified) YUNI source code with your software, with original
|
||||
// copyrights intact :
|
||||
// * If you distribute electronically, the source can be a separate download
|
||||
// (either from your own site if you modified YUNI, or to the official YUNI
|
||||
// website if you used an unmodified version) – just include a link in your
|
||||
// documentation
|
||||
// * If you distribute physical media, the YUNI source that you used to build
|
||||
// your application should be included on that media
|
||||
// Make it clear where you have customised it.
|
||||
//
|
||||
// In addition to the LGPL license text, the following exceptions / clarifications
|
||||
// to the LGPL conditions apply to YUNI:
|
||||
//
|
||||
// * Making modifications to YUNI configuration files, build scripts and
|
||||
// configuration headers such as yuni/platform.h in order to create a
|
||||
// customised build setup of YUNI with the otherwise unmodified source code,
|
||||
// does not constitute a derived work
|
||||
// * Building against YUNI headers which have inlined code does not constitute a
|
||||
// derived work
|
||||
// * Code which subclasses YUNI classes outside of the YUNI libraries does not
|
||||
// form a derived work
|
||||
// * Statically linking the YUNI libraries into a user application does not make
|
||||
// the user application a derived work.
|
||||
// * Using source code obsfucation on the YUNI source code when distributing it
|
||||
// is not permitted.
|
||||
// As per the terms of the LGPL, a "derived work" is one for which you have to
|
||||
// distribute source code for, so when the clauses above define something as not
|
||||
// a derived work, it means you don't have to distribute source code for it.
|
||||
// However, the original YUNI source code with all modifications must always be
|
||||
// made available.
|
||||
|
||||
#include "mutex.h"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <cerrno>
|
||||
|
||||
#if YUNI_ATOMIC_MUST_USE_MUTEX != 0
|
||||
#warning Atomic types must ue mutex. the implementation should be checked YUNI_OS_GCC_VERSION
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace Yuni
|
||||
{
|
||||
|
||||
enum // anonymous
|
||||
{
|
||||
/*!
|
||||
** \brief The spin count for the critical section object
|
||||
**
|
||||
** On single-processor systems, the spin count is ignored and the critical section
|
||||
** spin count is set to 0 (zero). On multiprocessor systems, if the critical section
|
||||
** is unavailable, the calling thread spinsdwSpinCount times before performing a
|
||||
** wait operation on a semaphore associated with the critical section. If the critical
|
||||
** section becomes free during the spin operation, the calling thread avoids the
|
||||
** wait operation.
|
||||
** \see http://msdn.microsoft.com/en-us/library/ms683476%28v=vs.85%29.aspx
|
||||
*/
|
||||
spinCount = 3000,
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline void Mutex::destroy()
|
||||
{
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifdef YUNI_OS_WINDOWS
|
||||
DeleteCriticalSection(&pSection);
|
||||
# else
|
||||
switch (::pthread_mutex_destroy(&pLock))
|
||||
{
|
||||
case 0: // Ok good
|
||||
{
|
||||
break;
|
||||
}
|
||||
// If an error happens, we will let the program continue but
|
||||
// it can becaome ugly around here...
|
||||
case EBUSY:
|
||||
{
|
||||
std::cerr << "\nattempt to destroy a mutex while it is locked or referenced\n";
|
||||
assert(false and "attempt to destroy a mutex while it is locked or referenced");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
std::cerr << "\nfailed to destroy a mutex\n";
|
||||
assert(false and "\nfailed to destroy a mutex\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
::pthread_mutexattr_destroy(&pAttr);
|
||||
# endif
|
||||
# endif // no thread safe
|
||||
}
|
||||
|
||||
|
||||
inline void Mutex::copy(const Mutex& rhs)
|
||||
{
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifdef YUNI_OS_WINDOWS
|
||||
InitializeCriticalSectionAndSpinCount(&pSection, spinCount);
|
||||
(void) rhs; // unused
|
||||
# else
|
||||
::pthread_mutexattr_init(&pAttr);
|
||||
int type; // = PTHREAD_MUTEX_NORMAL;
|
||||
if (0 == ::pthread_mutexattr_gettype(&rhs.pAttr, &type))
|
||||
{
|
||||
if (PTHREAD_MUTEX_RECURSIVE == type)
|
||||
{
|
||||
# if defined(YUNI_OS_DARWIN) or defined(YUNI_OS_FREEBSD) or defined(YUNI_OS_SOLARIS) or defined(YUNI_OS_SUNOS) or defined(YUNI_OS_HAIKU) or defined(YUNI_OS_CYGWIN)
|
||||
::pthread_mutexattr_settype(&pAttr, PTHREAD_MUTEX_RECURSIVE);
|
||||
# else
|
||||
::pthread_mutexattr_settype(&pAttr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
::pthread_mutex_init(& pLock, &pAttr);
|
||||
# endif
|
||||
# else
|
||||
(void) rhs; // unused
|
||||
# endif // no thread safe
|
||||
}
|
||||
|
||||
|
||||
|
||||
Mutex::Mutex(const Mutex& rhs)
|
||||
{
|
||||
copy(rhs);
|
||||
}
|
||||
|
||||
|
||||
Mutex::~Mutex()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
|
||||
Mutex::Mutex(bool recursive)
|
||||
{
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifdef YUNI_OS_WINDOWS
|
||||
(void) recursive; // already recursive on Windows
|
||||
InitializeCriticalSectionAndSpinCount(&pSection, spinCount);
|
||||
# else
|
||||
::pthread_mutexattr_init(&pAttr);
|
||||
if (recursive)
|
||||
{
|
||||
# if defined(YUNI_OS_DARWIN) or defined(YUNI_OS_FREEBSD) or defined(YUNI_OS_SOLARIS) or defined(YUNI_OS_SUNOS) or defined(YUNI_OS_HAIKU) or defined(YUNI_OS_CYGWIN)
|
||||
::pthread_mutexattr_settype(&pAttr, PTHREAD_MUTEX_RECURSIVE);
|
||||
# else
|
||||
::pthread_mutexattr_settype(&pAttr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
# endif
|
||||
}
|
||||
::pthread_mutex_init(&pLock, &pAttr);
|
||||
# endif
|
||||
# else
|
||||
(void) recursive;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
Mutex& Mutex::operator = (const Mutex& rhs)
|
||||
{
|
||||
// We will recreate the mutex
|
||||
destroy();
|
||||
copy(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace Yuni
|
@ -1,234 +0,0 @@
|
||||
// YUNI's default license is the GNU Lesser Public License (LGPL), with some
|
||||
// exclusions (see below). This basically means that you can get the full source
|
||||
// code for nothing, so long as you adhere to a few rules.
|
||||
//
|
||||
// Under the LGPL you may use YUNI for any purpose you wish, and modify it if you
|
||||
// require, as long as you:
|
||||
//
|
||||
// Pass on the (modified) YUNI source code with your software, with original
|
||||
// copyrights intact :
|
||||
// * If you distribute electronically, the source can be a separate download
|
||||
// (either from your own site if you modified YUNI, or to the official YUNI
|
||||
// website if you used an unmodified version) – just include a link in your
|
||||
// documentation
|
||||
// * If you distribute physical media, the YUNI source that you used to build
|
||||
// your application should be included on that media
|
||||
// Make it clear where you have customised it.
|
||||
//
|
||||
// In addition to the LGPL license text, the following exceptions / clarifications
|
||||
// to the LGPL conditions apply to YUNI:
|
||||
//
|
||||
// * Making modifications to YUNI configuration files, build scripts and
|
||||
// configuration headers such as yuni/platform.h in order to create a
|
||||
// customised build setup of YUNI with the otherwise unmodified source code,
|
||||
// does not constitute a derived work
|
||||
// * Building against YUNI headers which have inlined code does not constitute a
|
||||
// derived work
|
||||
// * Code which subclasses YUNI classes outside of the YUNI libraries does not
|
||||
// form a derived work
|
||||
// * Statically linking the YUNI libraries into a user application does not make
|
||||
// the user application a derived work.
|
||||
// * Using source code obsfucation on the YUNI source code when distributing it
|
||||
// is not permitted.
|
||||
// As per the terms of the LGPL, a "derived work" is one for which you have to
|
||||
// distribute source code for, so when the clauses above define something as not
|
||||
// a derived work, it means you don't have to distribute source code for it.
|
||||
// However, the original YUNI source code with all modifications must always be
|
||||
// made available.
|
||||
|
||||
#pragma once
|
||||
#define YUNI_OS_WINDOWS
|
||||
#define YUNI_HAS_CPP_MOVE
|
||||
#define YUNI_DECL
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
namespace Yuni
|
||||
{
|
||||
|
||||
/*!
|
||||
** \brief Mechanism to avoid the simultaneous use of a common resource
|
||||
**
|
||||
** \ingroup Threads
|
||||
*/
|
||||
class YUNI_DECL Mutex final
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
** \brief A class-level locking mechanism
|
||||
**
|
||||
** A class-level locking operation locks all objects in a given class during that operation
|
||||
*/
|
||||
template<class T>
|
||||
class ClassLevelLockable
|
||||
{
|
||||
public:
|
||||
//! A dedicated mutex for the class T
|
||||
static Mutex mutex;
|
||||
|
||||
}; // class ClassLevelLockable
|
||||
|
||||
|
||||
public:
|
||||
//! \name Constructor & Destructor
|
||||
//@{
|
||||
/*!
|
||||
** \brief Default constructor
|
||||
**
|
||||
** Recursive by default to keep homogeneous behavior between
|
||||
** platforms.
|
||||
*/
|
||||
explicit Mutex(bool recursive = true);
|
||||
/*!
|
||||
** \brief Copy constructor
|
||||
**
|
||||
** This constructor does actually nothing but it allows the compilation
|
||||
** of other classes which would implement a copy constructor
|
||||
*/
|
||||
Mutex(const Mutex&);
|
||||
|
||||
# ifdef YUNI_HAS_CPP_MOVE
|
||||
// an OS's native mutex must have invariant address and thus can not be moved
|
||||
Mutex(Mutex&&) = delete;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
** \brief Destructor
|
||||
*/
|
||||
~Mutex();
|
||||
//@}
|
||||
|
||||
//! \name Lock & Unlock
|
||||
//@{
|
||||
/*!
|
||||
** \brief Lock the mutex
|
||||
*/
|
||||
void lock();
|
||||
|
||||
/*!
|
||||
** \brief Try to lock the mutex
|
||||
**
|
||||
** \return True if the mutex has been locked, false otherwise
|
||||
*/
|
||||
bool trylock();
|
||||
|
||||
/*!
|
||||
** \brief Release the lock
|
||||
*/
|
||||
void unlock();
|
||||
//@}
|
||||
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifndef YUNI_OS_WINDOWS
|
||||
//! \name Native
|
||||
//@{
|
||||
//! Get the original PThread mutex
|
||||
::pthread_mutex_t& pthreadMutex();
|
||||
//! Get the original PThread mutex (const)
|
||||
const ::pthread_mutex_t& pthreadMutex() const;
|
||||
//@}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
||||
//! \name Operators
|
||||
//@{
|
||||
//! Operator = (do nothing)
|
||||
Mutex& operator = (const Mutex&);
|
||||
# ifdef YUNI_HAS_CPP_MOVE
|
||||
// an OS's native mutex must have invariant address and thus can not be moved
|
||||
Mutex& operator = (Mutex&&) = delete;
|
||||
#endif
|
||||
//@}
|
||||
|
||||
|
||||
private:
|
||||
//! Destroy the current mutex
|
||||
inline void destroy();
|
||||
//! Create the mutex with settings from another mutex
|
||||
inline void copy(const Mutex& rhs);
|
||||
|
||||
private:
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifdef YUNI_OS_WINDOWS
|
||||
//! The critical section
|
||||
CRITICAL_SECTION pSection;
|
||||
# else
|
||||
//! The PThread mutex
|
||||
::pthread_mutex_t pLock;
|
||||
::pthread_mutexattr_t pAttr;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
}; // class Mutex
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
** \brief Locks a mutex in the constructor and unlocks it in the destructor (RAII).
|
||||
**
|
||||
** This class is especially usefull for `get` accessor` and/or returned values
|
||||
** which have to be thread-safe.
|
||||
** This is a very common C++ idiom, known as "Resource Acquisition Is Initialization" (RAII).
|
||||
**
|
||||
** \code
|
||||
** class Foo
|
||||
** {
|
||||
** public:
|
||||
** Foo() : pValue(42) {}
|
||||
** ~Foo() {}
|
||||
** int getValue()
|
||||
** {
|
||||
** MutexLocker locker(pMutex);
|
||||
** return pValue;
|
||||
** }
|
||||
** void setValue(const int i)
|
||||
** {
|
||||
** pMutex.lock();
|
||||
** pValue = i;
|
||||
** pMutex.unlock();
|
||||
** }
|
||||
** private:
|
||||
** int pValue;
|
||||
** Mutex pMutex;
|
||||
** };
|
||||
** \endcode
|
||||
*/
|
||||
class MutexLocker final
|
||||
{
|
||||
public:
|
||||
//! \name Constructor & Destructor
|
||||
//@{
|
||||
/*!
|
||||
** \brief Constructor
|
||||
**
|
||||
** \param m The mutex to lock
|
||||
*/
|
||||
MutexLocker(Mutex& m);
|
||||
//! Destructor
|
||||
~MutexLocker();
|
||||
//@}
|
||||
|
||||
MutexLocker& operator = (const MutexLocker&) = delete;
|
||||
|
||||
private:
|
||||
//! Reference to the real mutex
|
||||
Mutex& pMutex;
|
||||
|
||||
}; // MutexLocker
|
||||
|
||||
|
||||
|
||||
|
||||
//! All mutexes for each class
|
||||
template<class T> Mutex Mutex::ClassLevelLockable<T>::mutex;
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace Yuni
|
||||
|
||||
# include "mutex.hxx"
|
@ -1,116 +0,0 @@
|
||||
// YUNI's default license is the GNU Lesser Public License (LGPL), with some
|
||||
// exclusions (see below). This basically means that you can get the full source
|
||||
// code for nothing, so long as you adhere to a few rules.
|
||||
|
||||
// Under the LGPL you may use YUNI for any purpose you wish, and modify it if you
|
||||
// require, as long as you:
|
||||
//
|
||||
// Pass on the (modified) YUNI source code with your software, with original
|
||||
// copyrights intact :
|
||||
// * If you distribute electronically, the source can be a separate download
|
||||
// (either from your own site if you modified YUNI, or to the official YUNI
|
||||
// website if you used an unmodified version) – just include a link in your
|
||||
// documentation
|
||||
// * If you distribute physical media, the YUNI source that you used to build
|
||||
// your application should be included on that media
|
||||
// Make it clear where you have customised it.
|
||||
//
|
||||
// In addition to the LGPL license text, the following exceptions / clarifications
|
||||
// to the LGPL conditions apply to YUNI:
|
||||
//
|
||||
// * Making modifications to YUNI configuration files, build scripts and
|
||||
// configuration headers such as yuni/platform.h in order to create a
|
||||
// customised build setup of YUNI with the otherwise unmodified source code,
|
||||
// does not constitute a derived work
|
||||
// * Building against YUNI headers which have inlined code does not constitute a
|
||||
// derived work
|
||||
// * Code which subclasses YUNI classes outside of the YUNI libraries does not
|
||||
// form a derived work
|
||||
// * Statically linking the YUNI libraries into a user application does not make
|
||||
// the user application a derived work.
|
||||
// * Using source code obsfucation on the YUNI source code when distributing it
|
||||
// is not permitted.
|
||||
// As per the terms of the LGPL, a "derived work" is one for which you have to
|
||||
// distribute source code for, so when the clauses above define something as not
|
||||
// a derived work, it means you don't have to distribute source code for it.
|
||||
// However, the original YUNI source code with all modifications must always be
|
||||
// made available.
|
||||
|
||||
#pragma once
|
||||
#include "mutex.h"
|
||||
|
||||
|
||||
|
||||
namespace Yuni
|
||||
{
|
||||
|
||||
inline void Mutex::lock()
|
||||
{
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifdef YUNI_OS_WINDOWS
|
||||
EnterCriticalSection(&pSection);
|
||||
# else
|
||||
::pthread_mutex_lock(&pLock);
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
inline bool Mutex::trylock()
|
||||
{
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifdef YUNI_OS_WINDOWS
|
||||
return (0 != TryEnterCriticalSection(&pSection));
|
||||
# else
|
||||
return (0 == ::pthread_mutex_trylock(&pLock));
|
||||
# endif
|
||||
# else
|
||||
return false;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
inline void Mutex::unlock()
|
||||
{
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifdef YUNI_OS_WINDOWS
|
||||
LeaveCriticalSection(&pSection);
|
||||
# else
|
||||
::pthread_mutex_unlock(&pLock);
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
# ifndef YUNI_NO_THREAD_SAFE
|
||||
# ifndef YUNI_OS_WINDOWS
|
||||
inline pthread_mutex_t& Mutex::pthreadMutex()
|
||||
{
|
||||
return pLock;
|
||||
}
|
||||
|
||||
inline const pthread_mutex_t& Mutex::pthreadMutex() const
|
||||
{
|
||||
return pLock;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
inline MutexLocker::MutexLocker(Mutex& m) :
|
||||
pMutex(m)
|
||||
{
|
||||
m.lock();
|
||||
}
|
||||
|
||||
|
||||
inline MutexLocker::~MutexLocker()
|
||||
{
|
||||
pMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace Yuni
|
@ -48,7 +48,6 @@
|
||||
#include "documentMap.h"
|
||||
#include "functionListPanel.h"
|
||||
#include "fileBrowser.h"
|
||||
#include "LongRunningOperation.h"
|
||||
#include "Common.h"
|
||||
|
||||
using namespace std;
|
||||
@ -1496,9 +1495,11 @@ void Notepad_plus::getMatchedFileNames(const TCHAR *dir, const vector<generic_st
|
||||
::FindClose(hFile);
|
||||
}
|
||||
|
||||
std::mutex replaceInFiles_mutex;
|
||||
|
||||
bool Notepad_plus::replaceInFiles()
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(replaceInFiles_mutex);
|
||||
|
||||
const TCHAR *dir2Search = _findReplaceDlg.getDir2Search();
|
||||
if (!dir2Search[0] || !::PathFileExists(dir2Search))
|
||||
@ -2165,9 +2166,11 @@ void Notepad_plus::copyMarkedLines()
|
||||
str2Cliboard(globalStr);
|
||||
}
|
||||
|
||||
std::mutex mark_mutex;
|
||||
|
||||
void Notepad_plus::cutMarkedLines()
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(mark_mutex);
|
||||
|
||||
int lastLine = _pEditView->lastZeroBasedLineNumber();
|
||||
generic_string globalStr = TEXT("");
|
||||
@ -2189,7 +2192,7 @@ void Notepad_plus::cutMarkedLines()
|
||||
|
||||
void Notepad_plus::deleteMarkedLines(bool isMarked)
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(mark_mutex);
|
||||
|
||||
int lastLine = _pEditView->lastZeroBasedLineNumber();
|
||||
|
||||
@ -2204,7 +2207,7 @@ void Notepad_plus::deleteMarkedLines(bool isMarked)
|
||||
|
||||
void Notepad_plus::pasteToMarkedLines()
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(mark_mutex);
|
||||
|
||||
int clipFormat;
|
||||
clipFormat = CF_UNICODETEXT;
|
||||
|
@ -38,16 +38,16 @@
|
||||
#include "fileBrowser.h"
|
||||
#include "Sorters.h"
|
||||
#include "verifySignedFile.h"
|
||||
#include "LongRunningOperation.h"
|
||||
#include "md5.h"
|
||||
#include "sha-256.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
std::mutex command_mutex;
|
||||
|
||||
void Notepad_plus::macroPlayback(Macro macro)
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
|
||||
_playingBackMacro = true;
|
||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||
@ -258,7 +258,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_EDIT_UNDO:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
_pEditView->execute(WM_UNDO);
|
||||
checkClipboard();
|
||||
checkUndoState();
|
||||
@ -267,7 +267,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_EDIT_REDO:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
_pEditView->execute(SCI_REDO);
|
||||
checkClipboard();
|
||||
checkUndoState();
|
||||
@ -345,7 +345,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_EDIT_PASTE:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
int eolMode = int(_pEditView->execute(SCI_GETEOLMODE));
|
||||
_pEditView->execute(SCI_PASTE);
|
||||
_pEditView->execute(SCI_CONVERTEOLS, eolMode);
|
||||
@ -354,7 +354,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_EDIT_PASTE_BINARY:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
if (!IsClipboardFormatAvailable(CF_TEXT))
|
||||
return;
|
||||
|
||||
@ -510,7 +510,7 @@ void Notepad_plus::command(int id)
|
||||
case IDM_EDIT_PASTE_AS_RTF:
|
||||
case IDM_EDIT_PASTE_AS_HTML:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
UINT f = RegisterClipboardFormat(id==IDM_EDIT_PASTE_AS_HTML?CF_HTML:CF_RTF);
|
||||
|
||||
if (!IsClipboardFormatAvailable(f))
|
||||
@ -553,7 +553,7 @@ void Notepad_plus::command(int id)
|
||||
case IDM_EDIT_SORTLINES_DECIMALDOT_ASCENDING:
|
||||
case IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
|
||||
size_t fromLine = 0, toLine = 0;
|
||||
size_t fromColumn = 0, toColumn = 0;
|
||||
@ -1495,7 +1495,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_EDIT_TRIMTRAILING:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
|
||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||
doTrim(lineTail);
|
||||
@ -1505,7 +1505,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_EDIT_TRIMLINEHEAD:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
|
||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||
doTrim(lineHeader);
|
||||
@ -1515,7 +1515,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_EDIT_TRIM_BOTH:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
|
||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||
doTrim(lineTail);
|
||||
@ -1533,7 +1533,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_EDIT_TRIMALL:
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
|
||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||
doTrim(lineTail);
|
||||
@ -2154,7 +2154,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
if (not buf->isReadOnly())
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(command_mutex);
|
||||
buf->setEolFormat(newFormat);
|
||||
_pEditView->execute(SCI_CONVERTEOLS, static_cast<int>(buf->getEolFormat()));
|
||||
}
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "ScintillaEditView.h"
|
||||
#include "EncodingMapper.h"
|
||||
#include "uchardet.h"
|
||||
#include "LongRunningOperation.h"
|
||||
|
||||
static const int blockSize = 128 * 1024 + 4;
|
||||
static const int CR = 0x0D;
|
||||
@ -798,9 +797,12 @@ For untitled document (new 4)
|
||||
In the current session, Notepad++
|
||||
1. track UNTITLED_NAME@CREATION_TIMESTAMP (backup\new 4@198776) in session.xml.
|
||||
*/
|
||||
|
||||
std::mutex backup_mutex;
|
||||
|
||||
bool FileManager::backupCurrentBuffer()
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(backup_mutex);
|
||||
|
||||
Buffer* buffer = _pNotepadPlus->getCurrentBuffer();
|
||||
bool result = false;
|
||||
@ -951,9 +953,11 @@ bool FileManager::deleteBufferBackup(BufferID id)
|
||||
return result;
|
||||
}
|
||||
|
||||
std::mutex save_mutex;
|
||||
|
||||
bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, generic_string * error_msg)
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(save_mutex);
|
||||
|
||||
Buffer* buffer = getBufferByID(id);
|
||||
bool isHiddenOrSys = false;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "ScintillaEditView.h"
|
||||
#include "Notepad_plus_msgs.h"
|
||||
#include "UniConversion.h"
|
||||
#include "LongRunningOperation.h"
|
||||
#include "localization.h"
|
||||
|
||||
using namespace std;
|
||||
@ -772,6 +771,8 @@ void FindReplaceDlg::resizeDialogElements(LONG newWidth)
|
||||
}
|
||||
}
|
||||
|
||||
std::mutex findOps_mutex;
|
||||
|
||||
INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
@ -1086,7 +1087,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
|
||||
case IDREPLACE :
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(findOps_mutex);
|
||||
|
||||
if (_currentStatus == REPLACE_DLG)
|
||||
{
|
||||
setStatusbarMessage(TEXT(""), FSNoMessage);
|
||||
@ -1169,7 +1171,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
|
||||
case IDD_FINDINFILES_REPLACEINFILES :
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(findOps_mutex);
|
||||
|
||||
setStatusbarMessage(TEXT(""), FSNoMessage);
|
||||
const int filterSize = 256;
|
||||
TCHAR filters[filterSize];
|
||||
@ -1209,7 +1212,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
|
||||
case IDC_REPLACE_OPENEDFILES :
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(findOps_mutex);
|
||||
|
||||
if (_currentStatus == REPLACE_DLG)
|
||||
{
|
||||
setStatusbarMessage(TEXT(""), FSNoMessage);
|
||||
@ -1229,7 +1233,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
|
||||
case IDREPLACEALL :
|
||||
{
|
||||
LongRunningOperation op;
|
||||
std::lock_guard<std::mutex> lock(findOps_mutex);
|
||||
|
||||
if (_currentStatus == REPLACE_DLG)
|
||||
{
|
||||
setStatusbarMessage(TEXT(""), FSNoMessage);
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "Processus.h"
|
||||
#include "PluginsManager.h"
|
||||
#include "verifySignedFile.h"
|
||||
#include "LongRunningOperation.h"
|
||||
|
||||
#define TEXTFILE 256
|
||||
#define IDR_PLUGINLISTJSONFILE 101
|
||||
|
@ -272,8 +272,6 @@ copy ..\src\contextMenu.xml ..\bin64\contextMenu.xml
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\MISC\Common\LongRunningOperation.cpp" />
|
||||
<ClCompile Include="..\src\MISC\Common\mutex.cpp" />
|
||||
<ClCompile Include="..\src\MISC\Common\verifySignedfile.cpp" />
|
||||
<ClCompile Include="..\src\MISC\md5\md5Dlgs.cpp" />
|
||||
<ClCompile Include="..\src\MISC\sha2\sha-256.cpp" />
|
||||
@ -538,9 +536,6 @@ copy ..\src\contextMenu.xml ..\bin64\contextMenu.xml
|
||||
<None Include="..\src\cursors\drag_plus.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\MISC\Common\LongRunningOperation.h" />
|
||||
<ClInclude Include="..\src\MISC\Common\mutex.h" />
|
||||
<ClInclude Include="..\src\MISC\Common\mutex.hxx" />
|
||||
<ClInclude Include="..\src\MISC\Common\verifySignedfile.h" />
|
||||
<ClInclude Include="..\src\MISC\md5\md5.h" />
|
||||
<ClInclude Include="..\src\MISC\md5\md5Dlgs.h" />
|
||||
|
Loading…
Reference in New Issue
Block a user