summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/threads.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/threads.cpp b/test/threads.cpp
index 1fa26020..0454761d 100644
--- a/test/threads.cpp
+++ b/test/threads.cpp
@@ -101,6 +101,25 @@ protected:
delete thread;
+ /* Test waiting on a thread that isn't running. */
+ thread = new Thread();
+
+ timeout = !thread->wait();
+ if (timeout) {
+ cout << "Waiting for non-started thread timed out" << endl;
+ return TestFail;
+ }
+
+ thread->start();
+ thread->exit(0);
+ thread->wait();
+
+ timeout = !thread->wait();
+ if (timeout) {
+ cout << "Waiting for already stopped thread timed out" << endl;
+ return TestFail;
+ }
+
return TestPass;
}