File clucene-2.3.3.4-fix-threads.patch of Package mingw64-clucene
Added a little patch to fix up some compile problems related to threads
on Win64 targets.
--- a/src/shared/CLucene/LuceneThreads.h
+++ b/src/shared/CLucene/LuceneThreads.h
@@ -30,6 +30,9 @@
#define _LUCENE_ATOMIC_INC(theInteger) (++(*theInteger))
#define _LUCENE_ATOMIC_DEC(theInteger) (--(*theInteger))
#define _LUCENE_ATOMIC_INT int
+
+ #define _LUCENE_ATOMIC_INT_SET(x, v) x=v
+ #define _LUCENE_ATOMIC_INT_GET(x) x
#else
#if defined(_LUCENE_DONTIMPLEMENT_THREADMUTEX)
//do nothing
--- a/src/core/CLucene/store/FSDirectory.cpp
+++ b/src/core/CLucene/store/FSDirectory.cpp
@@ -582,7 +582,9 @@
void FSDirectory::close(){
SCOPED_LOCK_MUTEX(DIRECTORIES_LOCK)
{
+#if !defined(_CL_DISABLE_MULTITHREADING)
THIS_LOCK.lock();
+#endif
CND_PRECONDITION(directory[0]!=0,"directory is not open");
@@ -595,7 +597,9 @@
return;
}
}
+#if !defined(_CL_DISABLE_MULTITHREADING)
THIS_LOCK.unlock();
+#endif
}
}
--- a/src/shared/CLucene/util/Misc.cpp
+++ b/src/shared/CLucene/util/Misc.cpp
@@ -474,6 +474,7 @@
}
return toString(ids[value]);
}
+#if !defined(_CL_DISABLE_MULTITHREADING)
std::string Misc::toString(const int32_t value){
char buf[20];
TCHAR tbuf[20];
@@ -481,6 +482,7 @@
STRCPY_TtoA(buf,tbuf,20);
return buf;
}
+#endif
std::string Misc::toString(const int64_t value){
char buf[20];
TCHAR tbuf[20];
--- a/src/shared/CLucene/util/Misc.h
+++ b/src/shared/CLucene/util/Misc.h
@@ -67,7 +67,9 @@
static std::string toString(const int32_t value);
static std::string toString(const int64_t value);
+#if !defined(_CL_DISABLE_MULTITHREADING)
static std::string toString(const _LUCENE_THREADID_TYPE value);
+#endif
static std::string toString(const bool value);
static std::string toString(const float_t value);
static std::string toString(const TCHAR* s, int32_t len=-1);