Index: /trunk/src/3rdparty/clucene/src/CLucene/LuceneThreads.h
===================================================================
--- /trunk/src/3rdparty/clucene/src/CLucene/LuceneThreads.h	(revision 629)
+++ /trunk/src/3rdparty/clucene/src/CLucene/LuceneThreads.h	(revision 630)
@@ -45,4 +45,9 @@
 		#endif
 		#include "CLucene/config/threadCSection.h"
+	#elif defined(_CL_HAVE_OS2_THREADS) || defined(__OS2__)
+		#if !defined(_CL_HAVE_OS2_THREADS)
+		#define _CL_HAVE_OS2_THREADS
+		#endif
+		#include "CLucene/config/threadOS2.h"
 	#else
 		#error A valid thread library was not found
Index: /trunk/src/3rdparty/clucene/src/CLucene/config/PlatformOS2.h
===================================================================
--- /trunk/src/3rdparty/clucene/src/CLucene/config/PlatformOS2.h	(revision 630)
+++ /trunk/src/3rdparty/clucene/src/CLucene/config/PlatformOS2.h	(revision 630)
@@ -0,0 +1,11 @@
+/*------------------------------------------------------------------------------
+* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
+* 
+* Distributable under the terms of either the Apache License (Version 2.0) or 
+* the GNU Lesser General Public License, as specified in the COPYING file.
+------------------------------------------------------------------------------*/
+// It is internal CLucene header - DO NOT include it directly
+
+# define PATH_DELIMITER  _T("\\")
+# define PATH_DELIMITERA "\\"
+# define PATH_DELIMITERC '\\'
Index: /trunk/src/3rdparty/clucene/src/CLucene/config/ThreadOS2.h
===================================================================
--- /trunk/src/3rdparty/clucene/src/CLucene/config/ThreadOS2.h	(revision 630)
+++ /trunk/src/3rdparty/clucene/src/CLucene/config/ThreadOS2.h	(revision 630)
@@ -0,0 +1,57 @@
+/*------------------------------------------------------------------------------
+* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
+*
+* Distributable under the terms of either the Apache License (Version 2.0) or
+* the GNU Lesser General Public License, as specified in the COPYING file.
+------------------------------------------------------------------------------*/
+//NOTE: do not include this file directly, it is included from lucene internally.
+
+#ifndef lucene_config_threadOS2_h
+#define lucene_config_threadOS2_h
+
+#if defined(_LUCENE_PRAGMA_ONCE)
+# pragma once
+#endif
+
+#define	INCL_DOSPROCESS
+#define	INCL_DOSSEMAPHORES
+#include <os2.h>
+
+
+CL_NS_DEF(util)
+	class mutex_os2
+	{
+	private:
+		HMTX	mtx;
+	public:
+		mutex_os2(const mutex_os2& clone);
+		mutex_os2();
+		~mutex_os2();
+		void lock();
+		void unlock();
+
+		static ULONG getCurrentTid(void);
+	};
+
+	class CLuceneThreadIdCompare
+	{
+	public:
+
+		enum
+		{	// parameters for hash table
+			bucket_size = 4,	// 0 < bucket_size
+			min_buckets = 8
+		};	// min_buckets = 2 ^^ N, 0 < N
+
+		bool operator()( ULONG t1, ULONG t2 ) const{
+			return t1 < t2;
+		}
+	};
+
+	#define _LUCENE_SLEEP(x) DosSleep(x)
+	#define _LUCENE_THREADMUTEX CL_NS(util)::mutex_os2
+	#define _LUCENE_CURRTHREADID CL_NS(util)::mutex_os2::getCurrentTid()
+	#define _LUCENE_THREADID_TYPE ULONG
+CL_NS_END
+
+#endif //lucene_config_threadCSection_h
Index: /trunk/src/3rdparty/clucene/src/CLucene/config/compiler.h
===================================================================
--- /trunk/src/3rdparty/clucene/src/CLucene/config/compiler.h	(revision 629)
+++ /trunk/src/3rdparty/clucene/src/CLucene/config/compiler.h	(revision 630)
@@ -80,4 +80,9 @@
 #define _WIN32
 #include "CLucene/config/PlatformWin32.h"
+
+#elif defined (__OS2__)
+#undef _OS2
+#define _OS2
+#include "CLucene/config/PlatformOS2.h"
 
 #elif defined (__WIN16) || defined (WIN16) || defined (_WIN16)
Index: /trunk/src/3rdparty/clucene/src/CLucene/config/threads.cpp
===================================================================
--- /trunk/src/3rdparty/clucene/src/CLucene/config/threads.cpp	(revision 629)
+++ /trunk/src/3rdparty/clucene/src/CLucene/config/threads.cpp	(revision 630)
@@ -48,26 +48,26 @@
 	  extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId();
    #endif
-	
+
 	mutex_win32::mutex_win32(const mutex_win32& clone){
-		InitializeCriticalSection(&mtx); 
+		InitializeCriticalSection(&mtx);
 	}
 	mutex_win32::mutex_win32()
-	{ 
-		InitializeCriticalSection(&mtx); 
+	{
+		InitializeCriticalSection(&mtx);
 	}
-	
+
 	mutex_win32::~mutex_win32()
-	{ 
-		DeleteCriticalSection(&mtx); 
+	{
+		DeleteCriticalSection(&mtx);
 	}
-	
+
 	void mutex_win32::lock()
-	{ 
-		EnterCriticalSection(&mtx); 
+	{
+		EnterCriticalSection(&mtx);
 	}
-	
+
 	void mutex_win32::unlock()
-	{ 
-		LeaveCriticalSection(&mtx); 
+	{
+		LeaveCriticalSection(&mtx);
 	}
 
@@ -76,10 +76,10 @@
 #elif defined(_CL_HAVE_PTHREAD)
 	#include "CLucene/config/threadPthread.h"
-		
+
 	#ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
 		bool mutex_pthread_attr_initd=false;
 		pthread_mutexattr_t mutex_pthread_attr;
 	#endif
-	
+
 	#ifdef _CL__CND_DEBUG
 		#define _CLPTHREAD_CHECK(c,m) CND_PRECONDITION(c==0,m)
@@ -92,5 +92,5 @@
 		_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, &mutex_pthread_attr), "mutex_pthread(clone) constructor failed")
 		#else
-	  	#if defined(__hpux) && defined(_DECTHREADS_)
+		#if defined(__hpux) && defined(_DECTHREADS_)
 			_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, pthread_mutexattr_default), "mutex_pthread(clone) constructor failed")
 		#else
@@ -102,10 +102,10 @@
 	}
 	mutex_pthread::mutex_pthread()
-	{ 
+	{
 		#ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
-	  	if ( mutex_pthread_attr_initd == false ){
-	  		pthread_mutexattr_init(&mutex_pthread_attr);
-		  	pthread_mutexattr_settype(&mutex_pthread_attr, PTHREAD_MUTEX_RECURSIVE);
-		  	mutex_pthread_attr_initd = true;
+		if ( mutex_pthread_attr_initd == false ){
+			pthread_mutexattr_init(&mutex_pthread_attr);
+			pthread_mutexattr_settype(&mutex_pthread_attr, PTHREAD_MUTEX_RECURSIVE);
+			mutex_pthread_attr_initd = true;
 		}
 		_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, &mutex_pthread_attr), "mutex_pthread(clone) constructor failed")
@@ -141,7 +141,7 @@
 		#endif
 	}
-	
+
 	void mutex_pthread::unlock()
-	{ 
+	{
 		#ifndef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
 		--lockCount;
@@ -156,4 +156,39 @@
 	}
 
+#elif defined(_CL_HAVE_OS2_THREADS)
+	#include "CLucene/config/threadOS2.h"
+
+	mutex_os2::mutex_os2(const mutex_os2& clone)
+	{
+		DosCreateMutexSem(NULL, &mtx, 0, FALSE);
+	}
+
+	mutex_os2::mutex_os2()
+	{
+		DosCreateMutexSem(NULL, &mtx, 0, FALSE);
+	}
+
+	mutex_os2::~mutex_os2()
+	{
+		DosCloseMutexSem(mtx);
+	}
+
+	void mutex_os2::lock()
+	{
+		DosRequestMutexSem(mtx, SEM_INDEFINITE_WAIT);
+	}
+
+	void mutex_os2::unlock()
+	{
+		DosReleaseMutexSem(mtx);
+	}
+
+	ULONG mutex_os2::getCurrentTid(void)
+	{
+		PTIB pTIB;
+		return (DosGetInfoBlocks(&pTIB, NULL) == 0) ?
+				pTIB->tib_ptib2->tib2_ultid : 1;
+	}
+
 #endif //thread impl choice
 
