summaryrefslogtreecommitdiff
path: root/cpp/include/IceUtil/Thread.h
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2006-03-03 16:08:52 +0000
committerBernard Normier <bernard@zeroc.com>2006-03-03 16:08:52 +0000
commit77dfed97c33a559fc98e23aa7a8152faa0120895 (patch)
treea251f7a67917108a3d6aaad43c10e4db15fa61e1 /cpp/include/IceUtil/Thread.h
parentAdded windows project files for retry test (diff)
downloadice-77dfed97c33a559fc98e23aa7a8152faa0120895.tar.bz2
ice-77dfed97c33a559fc98e23aa7a8152faa0120895.tar.xz
ice-77dfed97c33a559fc98e23aa7a8152faa0120895.zip
Better fix for bug #824
Diffstat (limited to 'cpp/include/IceUtil/Thread.h')
-rw-r--r--cpp/include/IceUtil/Thread.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/cpp/include/IceUtil/Thread.h b/cpp/include/IceUtil/Thread.h
index 76b4ca82313..5f2e6b837c4 100644
--- a/cpp/include/IceUtil/Thread.h
+++ b/cpp/include/IceUtil/Thread.h
@@ -23,6 +23,10 @@ class ICE_UTIL_API ThreadControl
{
public:
+ //
+ // Constructs a ThreadControl representing the current thread.
+ // join and detach cannot be called on such ThreadControl object.
+ //
ThreadControl();
#ifdef _WIN32
@@ -31,12 +35,14 @@ public:
ThreadControl(pthread_t);
#endif
- ThreadControl(const ThreadControl&);
-
- ~ThreadControl();
-
- ThreadControl& operator=(const ThreadControl&);
+ //
+ // Default copy destructor, assignment operator and destructor OK
+ //
+ //
+ // == and != are meaningful only before the thread is joined/detached,
+ // or while the thread is still running.
+ //
bool operator==(const ThreadControl&) const;
bool operator!=(const ThreadControl&) const;
@@ -83,6 +89,13 @@ private:
DWORD _id;
#else
pthread_t _thread;
+
+ //
+ // Used to prevent joining/detaching a ThreadControl constructed
+ // with the default constructor. Only needed to enforce our
+ // portable join/detach behavior.
+ //
+ const bool _detachable;
#endif
};
@@ -104,8 +117,7 @@ public:
bool operator<(const Thread&) const;
//
- // Check whether a thread is still alive. This is useful to implement
- // a non-blocking join().
+ // Check whether a thread is still alive.
//
bool isAlive() const;