diff options
author | Bernard Normier <bernard@zeroc.com> | 2012-08-09 15:40:44 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2012-08-09 15:40:44 -0400 |
commit | 87ae1f009ce03d18e459ad8d66050da9a9f63144 (patch) | |
tree | 40118e7d5f3ce44688de309d6c8c4e13a26b6ac3 /cpp/src | |
parent | WinRT Endpoint fixes for encoding11 (diff) | |
download | ice-87ae1f009ce03d18e459ad8d66050da9a9f63144.tar.bz2 ice-87ae1f009ce03d18e459ad8d66050da9a9f63144.tar.xz ice-87ae1f009ce03d18e459ad8d66050da9a9f63144.zip |
Added native cond-var implementation on Windows (bug #2667)
for Visual Studio 2012 and up
Removed all #define and checks for _WIN32_WINNT (no longer needed)
Misc build fixes for Visual Studio
IceUtil/Config.h cleanup (minor)
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/Makefile.mak | 1 | ||||
-rw-r--r-- | cpp/src/Ice/Network.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 8 | ||||
-rw-r--r-- | cpp/src/IceUtil/Cond.cpp | 27 | ||||
-rwxr-xr-x[-rw-r--r--] | cpp/src/IceUtil/FileUtil.cpp | 10 | ||||
-rw-r--r-- | cpp/src/IceUtil/RecMutex.cpp | 16 | ||||
-rw-r--r-- | cpp/src/iceserviceinstall/ServiceInstaller.cpp | 2 |
7 files changed, 52 insertions, 20 deletions
diff --git a/cpp/src/Ice/Makefile.mak b/cpp/src/Ice/Makefile.mak index c1f22dc6fa1..522da39075e 100644 --- a/cpp/src/Ice/Makefile.mak +++ b/cpp/src/Ice/Makefile.mak @@ -129,6 +129,7 @@ PDBFLAGS = /pdb:$(DLLNAME:.dll=.pdb) LD_DLLFLAGS = $(LD_DLLFLAGS) /entry:"ice_DLL_Main"
RES_FILE = Ice.res
+
$(LIBNAME): $(DLLNAME)
$(DLLNAME): $(OBJS) Ice.res
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index e4678b96502..1258fa186a9 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -17,14 +17,6 @@ # include <netinet/in.h> #endif -// -// The following is required for the Vista PSDK to bring in -// the definitions of the IN6_IS_ADDR_* macros. -// -#if defined(_WIN32) && !defined(_WIN32_WINNT) && WINAPI_FAMILY != 0x02 -# define _WIN32_WINNT 0x0501 -#endif - #include <Ice/Network.h> #include <IceUtil/StringUtil.h> #include <IceUtil/Unicode.h> diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 7217ec3b062..8e79614c66e 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -7,14 +7,6 @@ // // ********************************************************************** -// -// The following is required to bring in some definitions. Don't -// define with Metro Style apps. -// -#if defined(_WIN32) && !defined(_WIN32_WINNT) && WINAPI_FAMILY != 0x02 -# define _WIN32_WINNT 0x0501 -#endif - #include <Ice/ThreadPool.h> #include <IceUtil/DisableWarnings.h> #include <Ice/EventHandler.h> diff --git a/cpp/src/IceUtil/Cond.cpp b/cpp/src/IceUtil/Cond.cpp index a0f71460f1e..6cfa0700838 100644 --- a/cpp/src/IceUtil/Cond.cpp +++ b/cpp/src/IceUtil/Cond.cpp @@ -15,6 +15,31 @@ #ifdef _WIN32 +# ifdef ICE_HAS_WIN32_CONDVAR + +IceUtil::Cond::Cond() +{ + InitializeConditionVariable(&_cond); +} + +IceUtil::Cond::~Cond() +{ +} + +void +IceUtil::Cond::signal() +{ + WakeConditionVariable(&_cond); +} + +void +IceUtil::Cond::broadcast() +{ + WakeAllConditionVariable(&_cond); +} + +# else + IceUtilInternal::Semaphore::Semaphore(long initial) { #ifndef ICE_OS_WINRT @@ -305,6 +330,8 @@ IceUtil::Cond::timedDowait(const Time& timeout) const } } +# endif // ICE_HAS_WIN32_CONDVAR + #else IceUtil::Cond::Cond() diff --git a/cpp/src/IceUtil/FileUtil.cpp b/cpp/src/IceUtil/FileUtil.cpp index 58e321c5d63..9fe0a5f85d3 100644..100755 --- a/cpp/src/IceUtil/FileUtil.cpp +++ b/cpp/src/IceUtil/FileUtil.cpp @@ -208,7 +208,13 @@ IceUtilInternal::FileLock::FileLock(const std::string& path) : overlaped.InternalHigh = 0; overlaped.Offset = 0; overlaped.OffsetHigh = 0; + +#if defined(_MSC_VER) && (_MSC_VER >= 1600) overlaped.hEvent = nullptr; +#else + overlaped.hEvent = 0; +#endif + if(::LockFileEx(_fd, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, 0, 0, &overlaped) == 0) { ::CloseHandle(_fd); @@ -216,8 +222,8 @@ IceUtilInternal::FileLock::FileLock(const std::string& path) : } #endif // - // In Windows implementation we don't write the process pid to the file, as is - // not posible to read the file from other process while it is locked here. + // In Windows implementation we don't write the process pid to the file, as it is + // not possible to read the file from other process while it is locked here. // } diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp index 9558a6fed2b..46209f55bc6 100644 --- a/cpp/src/IceUtil/RecMutex.cpp +++ b/cpp/src/IceUtil/RecMutex.cpp @@ -79,6 +79,21 @@ IceUtil::RecMutex::unlock() const } } +# ifdef ICE_HAS_WIN32_CONDVAR +void +IceUtil::RecMutex::unlock(LockState& state) const +{ + state.mutex = &_mutex; + state.count = _count; + _count = 0; +} + +void +IceUtil::RecMutex::lock(LockState& state) const +{ + _count = state.count; +} +# else void IceUtil::RecMutex::unlock(LockState& state) const { @@ -93,6 +108,7 @@ IceUtil::RecMutex::lock(LockState& state) const EnterCriticalSection(&_mutex); _count = state.count; } +# endif #else diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.cpp b/cpp/src/iceserviceinstall/ServiceInstaller.cpp index 1b4e9aade6d..dd046a0755a 100644 --- a/cpp/src/iceserviceinstall/ServiceInstaller.cpp +++ b/cpp/src/iceserviceinstall/ServiceInstaller.cpp @@ -7,14 +7,12 @@ // // ********************************************************************** -#define _WIN32_WINNT 0x0500 #define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated #include <ServiceInstaller.h> #include <IceUtil/StringUtil.h> #include <IceUtil/FileUtil.h> - #include <Aclapi.h> #include <Sddl.h> |