summaryrefslogtreecommitdiff
path: root/cpp/test/IceUtil/thread/CreateTest.cpp
diff options
context:
space:
mode:
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;
+}