summaryrefslogtreecommitdiff
path: root/cppe/test/IceE/thread/CreateTest.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2005-07-05 11:09:55 +0000
committerDwayne Boone <dwayne@zeroc.com>2005-07-05 11:09:55 +0000
commit9b8cc712d4a41d71840416776bc94ee8485bb9b3 (patch)
tree7d467fdd6a66bc2b5878d82070d45adbd5c20414 /cppe/test/IceE/thread/CreateTest.cpp
parentcleaning the cache method out of ReferenceFactory (diff)
downloadice-9b8cc712d4a41d71840416776bc94ee8485bb9b3.tar.bz2
ice-9b8cc712d4a41d71840416776bc94ee8485bb9b3.tar.xz
ice-9b8cc712d4a41d71840416776bc94ee8485bb9b3.zip
Changed Ice to IceE EVERYWHERE!!!
Diffstat (limited to 'cppe/test/IceE/thread/CreateTest.cpp')
-rw-r--r--cppe/test/IceE/thread/CreateTest.cpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/cppe/test/IceE/thread/CreateTest.cpp b/cppe/test/IceE/thread/CreateTest.cpp
new file mode 100644
index 00000000000..aafa3c5c369
--- /dev/null
+++ b/cppe/test/IceE/thread/CreateTest.cpp
@@ -0,0 +1,79 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 <IceE/IceE.h>
+
+#include <stdio.h>
+
+#include <CreateTest.h>
+#include <TestCommon.h>
+
+using namespace std;
+using namespace IceE;
+
+static const 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()
+{
+ int nthreads = 4096;
+ //
+ // 4096 threads takes forever to start on the WinCe emulator.
+ //
+#ifdef _WIN32_WCE
+ nthreads = 512;
+#endif
+ for(int i = 0; i < 4096 ; ++i)
+ {
+ CreateTestThreadPtr t = new CreateTestThread();
+ ThreadControl control = t->start();
+ control.join();
+ test(t->threadran);
+#ifdef _WIN32_WCE
+ if((i % 32) == 0)
+ {
+ tprintf(".");
+ }
+#else
+ if((i % 256) == 0)
+ {
+ char buf[5];
+ sprintf(buf, "%04d", i);
+ tprintf("%s", buf);
+ }
+#endif
+ }
+#ifndef _WIN32_WCE
+ tprintf(" ");
+#endif
+}