summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-01 21:56:44 +0000
committeralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-01 21:56:44 +0000
commit241c2c7114d04aa01641f31a8274bed4811c1e53 (patch)
treed59c900d62f1bb5dd637981f06d54f6a91e42d8e
parent36bed04fb0776726fd7e88613e9387fea4a84128 (diff)
downloadATCD-241c2c7114d04aa01641f31a8274bed4811c1e53.tar.gz
Tue Jun 1 16:48:58 1999 Alexander Babu Arulanthu <alex@cs.wustl.edu>
-rw-r--r--ace/Asynch_IO.cpp21
-rw-r--r--ace/Asynch_IO.h52
-rw-r--r--ace/POSIX_Asynch_IO.cpp18
-rw-r--r--ace/POSIX_Asynch_IO.h8
-rw-r--r--ace/POSIX_Proactor.h15
-rw-r--r--ace/WIN32_Asynch_IO.cpp12
-rw-r--r--ace/config-linux-lxpthreads.h4
7 files changed, 90 insertions, 40 deletions
diff --git a/ace/Asynch_IO.cpp b/ace/Asynch_IO.cpp
index 373356337eb..beb26ff3839 100644
--- a/ace/Asynch_IO.cpp
+++ b/ace/Asynch_IO.cpp
@@ -86,7 +86,7 @@ ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation)
ACE_Asynch_Result::~ACE_Asynch_Result (void)
{
- // Proactor deletes the implementation when the <complete> finishes.
+ // Proactor deletes the implementation when the <complete> finishes.
}
ACE_Asynch_Result_Impl *
@@ -932,40 +932,33 @@ ACE_Handler::~ACE_Handler (void)
}
void
-ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result)
+ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result & /* result */)
{
- ACE_UNUSED_ARG (result);
}
void
-ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
+ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result & /* result */)
{
- ACE_UNUSED_ARG (result);
}
void
-ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result &result)
+ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result & /* result */)
{
-
- ACE_UNUSED_ARG (result);
}
void
-ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result)
+ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result & /* result */)
{
- ACE_UNUSED_ARG (result);
}
void
-ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result &result)
+ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result & /* result */)
{
- ACE_UNUSED_ARG (result);
}
void
-ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result &result)
+ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result & /* result */)
{
- ACE_UNUSED_ARG (result);
}
void
diff --git a/ace/Asynch_IO.h b/ace/Asynch_IO.h
index fb555a90610..32b0f921e9e 100644
--- a/ace/Asynch_IO.h
+++ b/ace/Asynch_IO.h
@@ -96,16 +96,17 @@ public:
u_long offset (void) const;
u_long offset_high (void) const;
- // This really make sense only when doing file I/O.
+ // This really makes sense only when doing file I/O.
//
// On WIN32, these are represented in the OVERLAPPED datastructure.
//
- // @@ On POSIX4-Unix, offset_high should be supported using aiocb64.
+ // @@ On POSIX4-Unix, offset_high should be supported using
+ // aiocb64.
int priority (void) const;
// Priority of the operation.
//
- // On POSIX4-Unix, this is supported. Works like <nice> in
+ // On POSIX4-Unix, this is supported. Priority works like <nice> in
// Unix. Negative values are not allowed. 0 means priority of the
// operation same as the process priority. 1 means priority of the
// operation is one less than process. And so forth.
@@ -163,12 +164,41 @@ public:
// correct handle.
int cancel (void);
- // On Win32, this cancels all pending accepts operations that were
- // issued by the calling thread. The function does not cancel
- // asynchronous operations issued by other threads.
+ // (Attempts to) cancel the asynchronous operation pending against
+ // the <handle> registered with this Operation.
+ //
+ // All completion notifications for the I/O operations will occur
+ // normally.
//
- // @@ POSIX: please implement me.
-
+ // = Return Values:
+ //
+ // -1 : Operation failed. (can get only in POSIX).
+ // 0 : All the operations were cancelled.
+ // 1 : All the operations were already finished in this
+ // handle. Unable to cancel them.
+ // 2 : Atleast one of the requested operations cannot be
+ // cancelled.
+ //
+ // There is slight difference in the semantics between NT and POSIX
+ // platforms which is given below.
+ //
+ // = Win32 :
+ //
+ // cancels all pending accepts operations that were issued by the
+ // calling thread. The function does not cancel asynchronous
+ // operations issued by other threads.
+ // All I/O operations that are canceled will complete with the
+ // error ERROR_OPERATION_ABORTED.
+ //
+ // = POSIX:
+ //
+ // Attempts to cancel one or more asynchronous I/O requests
+ // currently outstanding against the <handle> registered in this
+ // operation.
+ // For requested operations that are successfully canceled, the
+ // associated error status is set to ECANCELED.
+
+
// = Access methods.
ACE_Proactor* proactor (void) const;
@@ -242,7 +272,7 @@ public:
// supported. Works like <nice> in Unix. Negative values are not
// allowed. 0 means priority of the operation same as the process
// priority. 1 means priority of the operation is one less than
- // process. And so forth. On Win32, this is a no-op.
+ // process. And so forth. On Win32, <priority> is a no-op.
// <signal_number> is the POSIX4 real-time signal number to be used
// for the operation. <signal_number> ranges from ACE_SIGRTMIN to
// ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems.
@@ -350,7 +380,7 @@ public:
// supported. Works like <nice> in Unix. Negative values are not
// allowed. 0 means priority of the operation same as the process
// priority. 1 means priority of the operation is one less than
- // process. And so forth. On Win32, this is a no-op.
+ // process. And so forth. On Win32, this argument is a no-op.
// <signal_number> is the POSIX4 real-time signal number to be used
// for the operation. <signal_number> ranges from ACE_SIGRTMIN to
// ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems.
@@ -464,7 +494,7 @@ public:
// supported. Works like <nice> in Unix. Negative values are not
// allowed. 0 means priority of the operation same as the process
// priority. 1 means priority of the operation is one less than
- // process. And so forth. On Win32, this is a no-op.
+ // process. And so forth. On Win32, this argument is a no-op.
// <signal_number> is the POSIX4 real-time signal number to be used
// for the operation. <signal_number> ranges from ACE_SIGRTMIN to
// ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems.
diff --git a/ace/POSIX_Asynch_IO.cpp b/ace/POSIX_Asynch_IO.cpp
index 6c3683ed4fb..0c1649dbb80 100644
--- a/ace/POSIX_Asynch_IO.cpp
+++ b/ace/POSIX_Asynch_IO.cpp
@@ -169,8 +169,18 @@ ACE_POSIX_Asynch_Operation::open (ACE_Handler &handler,
int
ACE_POSIX_Asynch_Operation::cancel (void)
{
- // @@ Not implemented.
- ACE_NOTSUP_RETURN (0);
+ int result = ::aio_cancel (this->handle_, 0);
+
+ if (result == -1)
+ return -1;
+
+ // Check the return value and return 0/1/2 appropriately.
+ if (result == AIO_CANCELED)
+ return 0;
+ else if (result == AIO_ALLDONE)
+ return 1;
+ else if (result == AIO_NOTCANCELED)
+ return 2;
}
ACE_Proactor *
@@ -1830,6 +1840,10 @@ ACE_POSIX_Asynch_Accept_Handler::register_accept_call_i (ACE_POSIX_Asynch_Accept
return 0;
}
+// @@ We could have a queue where the <result> objects are arranged
+// according to the priority. This will help us to demux the accept
+// completions based on the priority. (Alex).
+
ACE_POSIX_Asynch_Accept_Result *
ACE_POSIX_Asynch_Accept_Handler::deregister_accept_call (void)
{
diff --git a/ace/POSIX_Asynch_IO.h b/ace/POSIX_Asynch_IO.h
index 56224912845..8fb292f726e 100644
--- a/ace/POSIX_Asynch_IO.h
+++ b/ace/POSIX_Asynch_IO.h
@@ -91,8 +91,7 @@ public:
int signal_number (void) const;
// POSIX4 real-time signal number to be used for the
// operation. <signal_number> ranges from SIGRTMIN to SIGRTMAX. By
- // default, SIGRTMIN is used to issue <aio_> calls. This is a no-op
- // on non-POSIX4 systems and returns 0.
+ // default, SIGRTMIN is used to issue <aio_> calls.
int post_completion (ACE_Proactor_Impl *proactor);
// Post <this> to the Proactor.
@@ -157,8 +156,7 @@ public:
// Proactor class.
int cancel (void);
- //
- // @@ Not implemented. Returns 0.
+ // Check the documentation for <ACE_Asynch_Operation::cancel>.
// = Access methods.
@@ -207,7 +205,7 @@ protected:
// This call is for the POSIX implementation. This method is used by
// <ACE_Asynch_Operation> to store some information with the
// Proactor after an <aio_> call is issued, so that the Proactor can
- // retrive this information to do <aio_return> and <aio_error>.
+ // retreve this information to do <aio_return> and <aio_error>.
// Passing a '0' ptr returns the status, indicating whether there
// are slots available or no. Passing a valid ptr stores the ptr
// with the Proactor.
diff --git a/ace/POSIX_Proactor.h b/ace/POSIX_Proactor.h
index ee3b4af9c01..5308a582550 100644
--- a/ace/POSIX_Proactor.h
+++ b/ace/POSIX_Proactor.h
@@ -71,18 +71,17 @@ public:
// user once this method is called.
int wake_up_dispatch_threads (void);
- // Add wakeup dispatch threads (reinit).
+ // @@ This is a no-op on POSIX platforms. Returns 0.
int close_dispatch_threads (int wait);
- // Close all dispatch threads.
+ // @@ This is a no-op on POSIX platforms. Returns 0.
size_t number_of_threads (void) const;
void number_of_threads (size_t threads);
- // Number of thread used as a parameter to CreatIoCompletionPort.
+ // @@ This is a no-op on POSIX platforms. Returns 0.
virtual ACE_HANDLE get_handle (void) const;
- // Get the event handle. This is a no-op in POSIX. Returns
- // ACE_INVALID_HANDLE.
+ // This is a no-op in POSIX. Returns ACE_INVALID_HANDLE.
// Methods used to create Asynch_IO_Result objects. We create the right
// objects here in these methods.
@@ -235,7 +234,7 @@ public:
// Post a result to the completion port of the Proactor.
// = Methods used to create Asynch_IO objects. We create the right
- // objects here in these methods.
+ // objects here in these methods.
virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void);
@@ -279,7 +278,9 @@ protected:
// operations can be pending at a time.
ACE_POSIX_Asynch_Result *result_list_ [ACE_RTSIG_MAX];
- // @@ I am keeing an extra copy of the <aiocb_
+ // @@ Keeping an extra copy of the <aiocb_list> here so that we can
+ // avoid dynamic cast when we use the result object calling back
+ // the hook methods.
size_t aiocb_list_max_size_;
// To maintain the maximum size of the array (list).
diff --git a/ace/WIN32_Asynch_IO.cpp b/ace/WIN32_Asynch_IO.cpp
index 2a5b19452b7..5180bd8ed40 100644
--- a/ace/WIN32_Asynch_IO.cpp
+++ b/ace/WIN32_Asynch_IO.cpp
@@ -154,7 +154,17 @@ ACE_WIN32_Asynch_Operation::cancel (void)
// ERROR_OPERATION_ABORTED. All completion notifications for the I/O
// operations will occur normally.
- return (int) ::CancelIo (this->handle_);
+ // @@ This API returns 0 on failure. So, I am returning -1 in that
+ // case. Is that right? (Alex).
+
+ int result = (int) ::CancelIo (this->handle_);
+
+ if (result == 0)
+ // Couldnt cancel the operations.
+ return 2;
+
+ // result is non-zero. All the operations are cancelled then.
+ return 0;
#else /* Not ACE_HAS_WINNT4 && ACE_HAS_WINNT4!=0 && _MSC... */
diff --git a/ace/config-linux-lxpthreads.h b/ace/config-linux-lxpthreads.h
index a3a491587c5..d6b42ba31c9 100644
--- a/ace/config-linux-lxpthreads.h
+++ b/ace/config-linux-lxpthreads.h
@@ -28,6 +28,10 @@
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
+// AIO Stuff is present here. Eventhough I could nt get the
+// $ACE_ROOT/examples/Reactor/Proactor/<anything> to work.
+#define ACE_HAS_AIO_CALLS
+
#include "ace/config-linux-common.h"
#define ACE_HAS_SVR4_DYNAMIC_LINKING