summaryrefslogtreecommitdiff
path: root/cpp/test/IceUtil/thread/DetachTest.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-03-12 04:25:17 +0000
committerMichi Henning <michi@zeroc.com>2003-03-12 04:25:17 +0000
commit5fbef4d3304ddd53c29bcb3ebd89380dbbc94d6e (patch)
treedf685d3e358750fe97507811eb1861531884b5e6 /cpp/test/IceUtil/thread/DetachTest.cpp
parentRemoved unused definition of UnknownEndpointType. (diff)
downloadice-5fbef4d3304ddd53c29bcb3ebd89380dbbc94d6e.tar.bz2
ice-5fbef4d3304ddd53c29bcb3ebd89380dbbc94d6e.tar.xz
ice-5fbef4d3304ddd53c29bcb3ebd89380dbbc94d6e.zip
Removed _detached member from ThreadControl. Joining with a thread more
than once or detaching a detached thread or joining with a detached thread now has undefined behavior (instead of throwing an exception). Cleaned up a number of race conditions around the _id members of Thread and ThreadControl. Explicitly hid the assignment operator and copy constructor of Thread so we get better diagnostics for that.
Diffstat (limited to 'cpp/test/IceUtil/thread/DetachTest.cpp')
-rw-r--r--cpp/test/IceUtil/thread/DetachTest.cpp97
1 files changed, 0 insertions, 97 deletions
diff --git a/cpp/test/IceUtil/thread/DetachTest.cpp b/cpp/test/IceUtil/thread/DetachTest.cpp
deleted file mode 100644
index a23c8e7d01d..00000000000
--- a/cpp/test/IceUtil/thread/DetachTest.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003
-// ZeroC, Inc.
-// Billerica, MA, USA
-//
-// All Rights Reserved.
-//
-// Ice is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation.
-//
-// **********************************************************************
-
-#include <IceUtil/IceUtil.h>
-
-#include <stdio.h>
-
-#include <DetachTest.h>
-#include <TestCommon.h>
-
-using namespace std;
-using namespace IceUtil;
-
-static const string createTestName("thread detach");
-
-class DetachTestThread : public Thread
-{
-public:
-
- DetachTestThread()
- {
- }
-
- virtual void run()
- {
- }
-};
-
-typedef Handle<DetachTestThread> DetachTestThreadPtr;
-
-DetachTest::DetachTest() :
- TestBase(createTestName)
-{
-}
-
-void
-DetachTest::run()
-{
- //
- // Check that calling join() more than once raises ThreadSyscallException.
- //
- DetachTestThreadPtr t = new DetachTestThread();
- ThreadControl control = t->start();
- control.join();
- bool gotException = false;
- try {
- control.join();
- }
- catch(const ThreadSyscallException&)
- {
- gotException = true;
- }
- test(gotException);
-
- //
- // Check that calling detach() more than once raises ThreadSyscallException.
- //
- t = new DetachTestThread();
- control = t->start();
- control.detach();
- gotException = false;
- try {
- control.detach();
- }
- catch(const ThreadSyscallException&)
- {
- gotException = true;
- }
- test(gotException);
-
- //
- // Check that calling join() after detach() raises ThreadSyscallException.
- //
- t = new DetachTestThread();
- control = t->start();
- control.detach();
- gotException = false;
- try {
- control.join();
- }
- catch(const ThreadSyscallException&)
- {
- gotException = true;
- }
- test(gotException);
-}