summaryrefslogtreecommitdiff
path: root/library/binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/binary.cpp')
-rw-r--r--library/binary.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/library/binary.cpp b/library/binary.cpp
index 3a202711..1fd8c55f 100644
--- a/library/binary.cpp
+++ b/library/binary.cpp
@@ -3,12 +3,13 @@
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) *
// **************************************************************************
-//
+
#include "binary.h"
#include "../shared/file_io.h"
#include <vector>
#include <wx/stopwatch.h>
#include "../shared/int64.h"
+#include <boost/thread/tss.hpp>
inline
void setMinSize(std::vector<char>& buffer, size_t minSize)
@@ -71,11 +72,15 @@ bool zen::filesHaveSameContent(const Zstring& filename1, const Zstring& filename
FileInput file1(filename1); //throw (FileError)
FileInput file2(filename2); //throw (FileError)
- BufferSize bufferSize;
+ static boost::thread_specific_ptr<std::vector<char>> cpyBuf1;
+ static boost::thread_specific_ptr<std::vector<char>> cpyBuf2;
+ if (!cpyBuf1.get()) cpyBuf1.reset(new std::vector<char>());
+ if (!cpyBuf2.get()) cpyBuf2.reset(new std::vector<char>());
- static std::vector<char> memory1;
- static std::vector<char> memory2;
+ std::vector<char>& memory1 = *cpyBuf1;
+ std::vector<char>& memory2 = *cpyBuf2;
+ BufferSize bufferSize;
zen::UInt64 bytesCompared;
wxLongLong lastDelayViolation = wxGetLocalTimeMillis();
bgstack15