summaryrefslogtreecommitdiff
path: root/cpp/test/IceUtil/thread/SleepTest.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-02-10 16:12:42 +0100
committerJose <jose@zeroc.com>2015-02-10 16:12:42 +0100
commit5d20f8d730c593c75be0bd0057c74deb6672c0f3 (patch)
tree9589e9f87c94c7a597a5dfc3d6e3cd77e190882c /cpp/test/IceUtil/thread/SleepTest.cpp
parentRemoved IceDiscovery from android, UDP multicast isn't supported (diff)
downloadice-5d20f8d730c593c75be0bd0057c74deb6672c0f3.tar.bz2
ice-5d20f8d730c593c75be0bd0057c74deb6672c0f3.tar.xz
ice-5d20f8d730c593c75be0bd0057c74deb6672c0f3.zip
Fixed (ICE-5975) - Improve IceUtil::ThreadControl::sleep and wait primitives to better handle negative values
Diffstat (limited to 'cpp/test/IceUtil/thread/SleepTest.cpp')
-rw-r--r--cpp/test/IceUtil/thread/SleepTest.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/cpp/test/IceUtil/thread/SleepTest.cpp b/cpp/test/IceUtil/thread/SleepTest.cpp
new file mode 100644
index 00000000000..1c6b57b3df7
--- /dev/null
+++ b/cpp/test/IceUtil/thread/SleepTest.cpp
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <IceUtil/IceUtil.h>
+
+#include <stdio.h>
+
+#include <SleepTest.h>
+#include <TestCommon.h>
+
+using namespace std;
+using namespace IceUtil;
+
+static const string createTestName("thread sleep");
+
+SleepTest::SleepTest() :
+ TestBase(createTestName)
+{
+}
+
+void
+SleepTest::run()
+{
+ try
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::secondsDouble(-1));
+ test(false);
+ }
+ catch(const InvalidTimeoutException&)
+ {
+ }
+
+#ifdef _WIN32
+ try
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::secondsDouble(INFINITE));
+ test(false);
+ }
+ catch(const InvalidTimeoutException&)
+ {
+ }
+#endif
+}