summaryrefslogtreecommitdiff
path: root/cpp/test/IceUtil/thread/CreateTest.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2001-12-27 18:38:22 +0000
committerMatthew Newhook <matthew@zeroc.com>2001-12-27 18:38:22 +0000
commitca2b7f71b4133faf486a677b3744904c0f759471 (patch)
tree2ea5e06f611c338f8160a0c3bd36d069118926fe /cpp/test/IceUtil/thread/CreateTest.cpp
parentfile run.py was initially added on branch IceThread. (diff)
downloadice-ca2b7f71b4133faf486a677b3744904c0f759471.tar.bz2
ice-ca2b7f71b4133faf486a677b3744904c0f759471.tar.xz
ice-ca2b7f71b4133faf486a677b3744904c0f759471.zip
IceThread merge.
Diffstat (limited to 'cpp/test/IceUtil/thread/CreateTest.cpp')
-rw-r--r--cpp/test/IceUtil/thread/CreateTest.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/cpp/test/IceUtil/thread/CreateTest.cpp b/cpp/test/IceUtil/thread/CreateTest.cpp
new file mode 100644
index 00000000000..b63194a5c87
--- /dev/null
+++ b/cpp/test/IceUtil/thread/CreateTest.cpp
@@ -0,0 +1,64 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <IceUtil/IceUtil.h>
+
+#include <stdio.h>
+
+#include <CreateTest.h>
+#include <TestCommon.h>
+
+using namespace std;
+using namespace IceUtil;
+
+static const std::string createTestName("thread create");
+
+class CreateTestThread : public Thread
+{
+public:
+
+ CreateTestThread() :
+ threadran(false)
+ {
+ }
+
+ virtual void run()
+ {
+ threadran = true;
+ }
+
+ bool threadran;
+};
+
+typedef Handle<CreateTestThread> CreateTestThreadPtr;
+
+CreateTest::CreateTest() :
+ TestBase(createTestName)
+{
+}
+
+void
+CreateTest::run()
+{
+ for (int i = 0; i < 4096 ; ++i)
+ {
+ CreateTestThreadPtr t = new CreateTestThread();
+ ThreadControl control = t->start();
+ control.join();
+ test(t->threadran);
+ if ((i % 256) == 0)
+ {
+ char buf[5];
+ sprintf(buf, "%04d", i);
+ cout << buf << "" << flush;
+ }
+ }
+ cout << " " << flush;
+}