diff options
author | Steve Huston <shuston@riverace.com> | 2011-06-29 20:51:48 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2011-06-29 20:51:48 +0000 |
commit | cefbb7732e60ff1e2e42c764240eceb95bf05251 (patch) | |
tree | 0b9636d9b146925372606502f1cfec88addd5252 | |
parent | fd90ae9a00b4194e0b096c26d43461d539361828 (diff) | |
download | ATCD-cefbb7732e60ff1e2e42c764240eceb95bf05251.tar.gz |
ChangeLogTag:Wed Jun 29 20:47:33 UTC 2011 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ACE/ChangeLog | 15 | ||||
-rw-r--r-- | ACE/ace/Dev_Poll_Reactor.cpp | 5 | ||||
-rw-r--r-- | ACE/ace/Select_Reactor_T.cpp | 18 | ||||
-rw-r--r-- | ACE/ace/TP_Reactor.cpp | 5 | ||||
-rw-r--r-- | ACE/ace/WFMO_Reactor.cpp | 5 | ||||
-rw-r--r-- | ACE/tests/Bug_3974_Regression_Test.cpp | 84 | ||||
-rw-r--r-- | ACE/tests/run_test.lst | 1 | ||||
-rw-r--r-- | ACE/tests/tests.mpc | 7 |
8 files changed, 133 insertions, 7 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index c4ba2325ad0..96953740cdf 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,18 @@ +Wed Jun 29 20:47:33 UTC 2011 Steve Huston <shuston@riverace.com> + + * ace/Select_Reactor_T.cpp: + * ace/TP_Reactor.cpp: + * ace/Dev_Poll_Reactor.cpp: + * ace/WFMO_Reactor.cpp: + In handle_events(), if returning -1 because the reactor isn't + ready to handle events, also set errno to ESHUTDOWN to tell the + caller why. Fixes Bugzilla #3974. + + * tests/Bug_3974_Regression_Test.cpp: + * tests/tests.mpc: + * tests/run_test.lst: + New test for the above problem/fix. + Wed Jun 29 10:38:02 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> * ace/Thread_Manager.cpp: diff --git a/ACE/ace/Dev_Poll_Reactor.cpp b/ACE/ace/Dev_Poll_Reactor.cpp index 3a108a8abec..318c1c62579 100644 --- a/ACE/ace/Dev_Poll_Reactor.cpp +++ b/ACE/ace/Dev_Poll_Reactor.cpp @@ -1007,7 +1007,10 @@ ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value *max_wait_time) return result; if (this->deactivated_) - return -1; + { + errno = ESHUTDOWN; + return -1; + } // Update the countdown to reflect time waiting for the mutex. ACE_MT (countdown.update ()); diff --git a/ACE/ace/Select_Reactor_T.cpp b/ACE/ace/Select_Reactor_T.cpp index 2314132cafc..3fb2ebfe4e9 100644 --- a/ACE/ace/Select_Reactor_T.cpp +++ b/ACE/ace/Select_Reactor_T.cpp @@ -1405,15 +1405,25 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handle_events ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1); - if (ACE_OS::thr_equal (ACE_Thread::self (), - this->owner_) == 0 || this->deactivated_) - return -1; + if (ACE_OS::thr_equal (ACE_Thread::self (), this->owner_) == 0) + { + errno = EACCES; + return -1; + } + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } // Update the countdown to reflect time waiting for the mutex. countdown.update (); #else if (this->deactivated_) - return -1; + { + errno = ESHUTDOWN; + return -1; + } #endif /* ACE_MT_SAFE */ return this->handle_events_i (max_wait_time); diff --git a/ACE/ace/TP_Reactor.cpp b/ACE/ace/TP_Reactor.cpp index b917c0ed973..bd0a7c12884 100644 --- a/ACE/ace/TP_Reactor.cpp +++ b/ACE/ace/TP_Reactor.cpp @@ -161,7 +161,10 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time) // After getting the lock just just for deactivation.. if (this->deactivated_) - return -1; + { + errno = ESHUTDOWN; + return -1; + } // Update the countdown to reflect time waiting for the token. countdown.update (); diff --git a/ACE/ace/WFMO_Reactor.cpp b/ACE/ace/WFMO_Reactor.cpp index 398a96c4bef..dc31128812b 100644 --- a/ACE/ace/WFMO_Reactor.cpp +++ b/ACE/ace/WFMO_Reactor.cpp @@ -1683,7 +1683,10 @@ ACE_WFMO_Reactor::event_handling (ACE_Time_Value *max_wait_time, // Make sure we are not closed if (!this->open_for_business_ || this->deactivated_) - return -1; + { + errno = ESHUTDOWN; + return -1; + } // Stash the current time -- the destructor of this object will // automatically compute how much time elapsed since this method was diff --git a/ACE/tests/Bug_3974_Regression_Test.cpp b/ACE/tests/Bug_3974_Regression_Test.cpp new file mode 100644 index 00000000000..e58279fe65b --- /dev/null +++ b/ACE/tests/Bug_3974_Regression_Test.cpp @@ -0,0 +1,84 @@ +/** + * @file Bug_3974_Regression_Test.cpp + * + * $Id$ + * + * Reproduces the problems reported in bug 3974 + * http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=3974 + */ + +#include "test_config.h" + +#include "ace/Dev_Poll_Reactor.h" +#include "ace/Select_Reactor.h" +#include "ace/TP_Reactor.h" +#include "ace/WFMO_Reactor.h" +#include "ace/OS_NS_errno.h" + +bool +testit (ACE_Reactor_Impl *ri) +{ + int ret = 0; + ACE_Reactor r (ri); + ACE_Time_Value one (1); + r.end_reactor_event_loop (); + if ((ret = r.handle_events (one)) != -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Return value %d should be -1\n"), ret)); + return false; + } + if (errno != ESHUTDOWN) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("errno %d should be %d (ESHUTDOWN)\n"), + errno, ESHUTDOWN)); + return false; + } + + return true; +} + +// Main function. + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT ("Bug_3974_Regression_Test")); + int result = 0; + + ACE_Select_Reactor r1; + if (!testit (&r1)) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Select_Reactor failed\n"))); + result = 1; + } + + ACE_TP_Reactor r2; + if (!testit (&r2)) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("TP_Reactor failed\n"))); + result = 1; + } + +#ifdef ACE_WIN32 + ACE_WFMO_Reactor r3; + if (!testit (&r3)) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("WFMO_Reactor failed\n"))); + result = 1; + } +#endif /* ACE_WIN32 */ + +#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) + ACE_Dev_Poll_Reactor r4; + if (!testit (&r4)) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Dev_Poll_Reactor failed\n"))); + result = 1; + } +#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ + + ACE_END_TEST; + return 0; +} + diff --git a/ACE/tests/run_test.lst b/ACE/tests/run_test.lst index 47bacd10444..7278cde02c4 100644 --- a/ACE/tests/run_test.lst +++ b/ACE/tests/run_test.lst @@ -64,6 +64,7 @@ Bug_3878_Regression_Test Bug_3911_Regression_Test: !FIXED_BUGS_ONLY !ACE_FOR_TAO Bug_3912_Regression_Test: !STATIC Bug_3943_Regression_Test: !ACE_FOR_TAO +Bug_3974_Regression_Test CDR_Array_Test: !ACE_FOR_TAO CDR_File_Test: !ACE_FOR_TAO CDR_Test diff --git a/ACE/tests/tests.mpc b/ACE/tests/tests.mpc index 0465cd94371..0248ade6f7a 100644 --- a/ACE/tests/tests.mpc +++ b/ACE/tests/tests.mpc @@ -459,6 +459,13 @@ project(Bug_3943_Regression_Test) : acetest { } } +project(Bug_3974_Regression_Test) : acetest { + exename = Bug_3974_Regression_Test + Source_Files { + Bug_3974_Regression_Test.cpp + } +} + project(Cache Map Manager Test) : acetest { exename = Cache_Map_Manager_Test Source_Files { |