From: <sv...@ww...> - 2004-12-31 21:37:25
|
Author: delta Date: 2004-12-31 13:37:13 -0800 (Fri, 31 Dec 2004) New Revision: 1423 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/Thread.h trunk/CSP/SimData/VisualStudio2003/SimData.vcproj Log: * Latest version of pthreads for win changed the type of pthread_t. A small wrapper for Task:ThreadId is provided to garanty compatibility with this new version. This change is enabled when defining PTHREADS_WIN which should leave safe the GNU/Linux version. Also, the pthreads binaries have been renamed pthreadVC1. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1423 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-12-31 20:47:29 UTC (rev 1422) +++ trunk/CSP/SimData/CHANGES.current 2004-12-31 21:37:13 UTC (rev 1423) @@ -1,6 +1,13 @@ Version 0.4.0 (in progress) =========================== +2004-12-23: delta + * Latest version of pthreads for win changed the type of pthread_t. + A small wrapper for Task:ThreadId is provided to garanty compatibility + with this new version. This change is enabled when defining PTHREADS_WIN + which should leave safe the GNU/Linux version. Also, the pthreads binaries + have been renamed pthreadVC1.* + 2004-12-12: delta * Fixed a few warnings in Random.h under msvc. Hopefully gcc won't complain. Modified: trunk/CSP/SimData/Include/SimData/Thread.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Thread.h 2004-12-31 20:47:29 UTC (rev 1422) +++ trunk/CSP/SimData/Include/SimData/Thread.h 2004-12-31 21:37:13 UTC (rev 1423) @@ -139,7 +139,30 @@ friend class BaseThread; public: +#ifndef PTHREADS_WIN typedef pthread_t ThreadId; +#else + // small wrapper for pthreads win dated 11-22-2004 + struct ThreadId: public pthread_t { + ThreadId(unsigned int i) {x = i;} + ThreadId& operator=(const pthread_t& other) { + if (this != &other) { + x = other.x; + p = other.p; + } + return *this; + } + bool operator==(unsigned int i) const { + return x == i; + } + bool operator!=(unsigned int i) const { + return !(*this == i); + } + bool operator&&(bool other) const { + return (*this == 0) && other; + } + }; +#endif protected: /** Entry point for a new thread. @@ -256,6 +279,11 @@ ThreadCondition m_exit; }; +#ifdef PTHREADS_WIN +inline bool operator&&(bool lhs,const Task::ThreadId& rhs) { + return rhs.operator&&(lhs); +} +#endif /** Base class for wrapping a Posix thread. * Modified: trunk/CSP/SimData/VisualStudio2003/SimData.vcproj =================================================================== --- trunk/CSP/SimData/VisualStudio2003/SimData.vcproj 2004-12-31 20:47:29 UTC (rev 1422) +++ trunk/CSP/SimData/VisualStudio2003/SimData.vcproj 2004-12-31 21:37:13 UTC (rev 1423) @@ -30,7 +30,7 @@ OptimizeForProcessor="0" OptimizeForWindowsApplication="TRUE" AdditionalIncludeDirectories="../Include,$(PYTHON_PATH)/include" - PreprocessorDefinitions="NDEBUG;_USRDLL;SIMDATA_EXPORTS" + PreprocessorDefinitions="PTHREADS_WIN;NDEBUG;_USRDLL;SIMDATA_EXPORTS" StringPooling="TRUE" RuntimeLibrary="2" BufferSecurityCheck="FALSE" @@ -53,7 +53,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" - AdditionalDependencies="pthreadVC.lib" + AdditionalDependencies="pthreadVC1.lib" OutputFile="../SimData/_cSimData.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" @@ -110,7 +110,7 @@ Optimization="0" EnableIntrinsicFunctions="TRUE" AdditionalIncludeDirectories="../Include,$(PYTHON_PATH)/include" - PreprocessorDefinitions="_DEBUG;_USRDLL;SIMDATA_EXPORTS" + PreprocessorDefinitions="PTHREADS_WIN;_DEBUG;_USRDLL;SIMDATA_EXPORTS" BasicRuntimeChecks="3" RuntimeLibrary="3" RuntimeTypeInfo="TRUE" @@ -129,7 +129,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" - AdditionalDependencies="pthreadVC.lib" + AdditionalDependencies="pthreadVC1.lib" OutputFile="../SimData/_cSimDatad.dll" LinkIncremental="2" SuppressStartupBanner="TRUE" |