summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2002-09-09 20:59:55 +0000
committerSteve Huston <shuston@riverace.com>2002-09-09 20:59:55 +0000
commit5e9586fe305d98bb67f62e6bc4f90d76ba51626b (patch)
treec54943c478b4c46fb6694fef5a1821d03dbd6bf0
parentb9062ee30ec1b81a19a932ed28d390a92794f20a (diff)
downloadATCD-5e9586fe305d98bb67f62e6bc4f90d76ba51626b.tar.gz
ChangeLogTag:Mon Sep 9 16:57:41 2002 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLogs/ChangeLog-03a8
-rw-r--r--ace/POSIX_Asynch_IO.cpp14
-rw-r--r--examples/Reactor/Proactor/test_aiocb.cpp59
4 files changed, 51 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a2b4926cd8..164b7cb760c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Sep 9 16:57:41 2002 Steve Huston <shuston@riverace.com>
+
+ * ace/POSIX_Asynch_IO.cpp (cancel): Don't sanity-check the
+ proactor type - just call cancel_aio and let the proactor impl
+ figure it out.
+
+ * examples/Reactor/Proactor/test_aiocb.cpp: Fixes to not crash.
+
Mon Sep 09 11:37:13 2002 Nanbor Wang <nanbor@cs.wustl.edu>
* ace/OS.cpp (cond_timedwait): Changed to pass absolute time when
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 7a2b4926cd8..164b7cb760c 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,11 @@
+Mon Sep 9 16:57:41 2002 Steve Huston <shuston@riverace.com>
+
+ * ace/POSIX_Asynch_IO.cpp (cancel): Don't sanity-check the
+ proactor type - just call cancel_aio and let the proactor impl
+ figure it out.
+
+ * examples/Reactor/Proactor/test_aiocb.cpp: Fixes to not crash.
+
Mon Sep 09 11:37:13 2002 Nanbor Wang <nanbor@cs.wustl.edu>
* ace/OS.cpp (cond_timedwait): Changed to pass absolute time when
diff --git a/ace/POSIX_Asynch_IO.cpp b/ace/POSIX_Asynch_IO.cpp
index 6919fd863a6..8ecb78bba14 100644
--- a/ace/POSIX_Asynch_IO.cpp
+++ b/ace/POSIX_Asynch_IO.cpp
@@ -183,19 +183,7 @@ ACE_POSIX_Asynch_Operation::cancel (void)
{
if (!posix_aiocb_proactor_)
return -1;
-
- switch (posix_aiocb_proactor_->get_impl_type ())
- {
- case ACE_POSIX_Proactor::PROACTOR_SUN:
- case ACE_POSIX_Proactor::PROACTOR_AIOCB:
- case ACE_POSIX_Proactor::PROACTOR_SIG:
- return posix_aiocb_proactor_->cancel_aio (this->handle_);
-
- default:
- break;
- }
-
- return -1;
+ return posix_aiocb_proactor_->cancel_aio (this->handle_);
}
ACE_Proactor *
diff --git a/examples/Reactor/Proactor/test_aiocb.cpp b/examples/Reactor/Proactor/test_aiocb.cpp
index 008121b744a..c9c0d280f1b 100644
--- a/examples/Reactor/Proactor/test_aiocb.cpp
+++ b/examples/Reactor/Proactor/test_aiocb.cpp
@@ -95,7 +95,8 @@ Test_Aio::init (void)
// Init the buffers.
this->buffer_write_ = strdup ("Welcome to the world of AIO... AIO Rules !!!");
cout << "The buffer : " << this->buffer_write_ << endl;
- this->buffer_read_ = new char [strlen (this->buffer_write_)];
+ this->buffer_read_ = new char [strlen (this->buffer_write_) + 1];
+ return 0;
}
// Set the necessary things for the AIO stuff.
@@ -159,41 +160,49 @@ Test_Aio::do_aio (void)
cerr << "Return value :" << return_val << endl;
// Analyze return and error values.
- if (aio_error (list_aiocb [0]) != EINPROGRESS)
+ if (list_aiocb[0] != 0)
{
- if (aio_return (list_aiocb [0]) == -1)
+ if (aio_error (list_aiocb [0]) != EINPROGRESS)
{
- perror ("aio_return");
- return -1;
+ if (aio_return (list_aiocb [0]) == -1)
+ {
+ perror ("aio_return");
+ return -1;
+ }
+ else
+ {
+ // Successful. Store the pointer somewhere and make the
+ // entry NULL in the list.
+ this->aiocb_write_ = list_aiocb [0];
+ list_aiocb [0] = 0;
+ }
}
else
- {
- // Successful. Store the pointer somewhere and make the
- // entry NULL in the list.
- this->aiocb_write_ = list_aiocb [0];
- list_aiocb [0] = 0;
- }
+ cout << "AIO write in progress" << endl;
}
- else
- cout << "AIO in progress" << endl;
- if (aio_error (list_aiocb [1]) != EINPROGRESS)
+ if (list_aiocb[1] != 0)
{
- if (aio_return (list_aiocb [1]) == -1)
+ if (aio_error (list_aiocb [1]) != EINPROGRESS)
{
- perror ("aio_return");
- return -1;
+ int read_return = aio_return (list_aiocb[1]);
+ if (read_return == -1)
+ {
+ perror ("aio_return");
+ return -1;
+ }
+ else
+ {
+ // Successful. Store the pointer somewhere and make the
+ // entry NULL in the list.
+ this->aiocb_read_ = list_aiocb [1];
+ list_aiocb [1] = 0;
+ this->buffer_read_[read_return] = '\0';
+ }
}
else
- {
- // Successful. Store the pointer somewhere and make the
- // entry NULL in the list.
- this->aiocb_read_ = list_aiocb [1];
- list_aiocb [1] = 0;
- }
+ cout << "AIO read in progress" << endl;
}
- else
- cout << "AIO in progress" << endl;
// Is it done?
if ((list_aiocb [0] == 0) && (list_aiocb [1] == 0))