summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>1998-10-15 21:46:22 +0000
committerSteve Huston <shuston@riverace.com>1998-10-15 21:46:22 +0000
commit42474e4d525b7c8f11afb715c27d4aa0824926b7 (patch)
tree9d5bfbcff3bbaed5ee4044419b24abdf5efb819c
parent80c4045c9521c77dc6024a98b52b4036e46052f3 (diff)
downloadATCD-42474e4d525b7c8f11afb715c27d4aa0824926b7.tar.gz
Try suspend/resume/kill on pthreads, but don't allow any errors other than
ENOTSUP.
-rw-r--r--tests/Thread_Manager_Test.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/Thread_Manager_Test.cpp b/tests/Thread_Manager_Test.cpp
index 63619537650..757333cd2dd 100644
--- a/tests/Thread_Manager_Test.cpp
+++ b/tests/Thread_Manager_Test.cpp
@@ -199,13 +199,16 @@ main (int, ASYS_TCHAR *[])
ACE_ASSERT (grp_id != -1);
thread_start->wait ();
- // Pthreads doesn't do suspend/resume.
-#if !defined (ACE_HAS_PTHREADS)
// Wait for 1 second and then suspend every thread in the group.
ACE_OS::sleep (1);
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) suspending group\n")));
-
- ACE_ASSERT (thr_mgr->suspend_grp (grp_id) != -1);
+ if (thr_mgr->suspend_grp (grp_id) == -1)
+ {
+ // Pthreads w/o UNIX 98 extensions doesn't support suspend/resume,
+ // so it's allowed to ENOTSUP; anything else is a hard fail.
+ ACE_ASSERT (errno == ENOTSUP);
+ ACE_DEBUG((LM_DEBUG, "%p\n", "suspend_grp"));
+ }
// Wait for 1 more second and then resume every thread in the
// group.
@@ -213,8 +216,11 @@ main (int, ASYS_TCHAR *[])
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) resuming group\n")));
- ACE_ASSERT (thr_mgr->resume_grp (grp_id) != -1);
-#endif /* ! ACE_HAS_PTHREADS */
+ if (thr_mgr->resume_grp (grp_id) == -1)
+ {
+ ACE_ASSERT (errno == ENOTSUP);
+ ACE_DEBUG((LM_DEBUG, "%p\n", "suspend_grp"));
+ }
// Wait for 1 more second and then send a SIGINT to every thread in
// the group.
@@ -226,6 +232,9 @@ main (int, ASYS_TCHAR *[])
thr_mgr->kill_grp (grp_id, SIGINT);
#elif !defined (ACE_HAS_PTHREADS_DRAFT4)
ACE_ASSERT (thr_mgr->kill_grp (grp_id, SIGINT) != -1);
+#else
+ if (thr_mgr->kill_grp (grp_id, SIGINT) == -1)
+ ACE_ASSERT (errno == ENOTSUP);
#endif /* ACE_HAS_WTHREADS */
// Wait for 1 more second and then cancel all the threads.