summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoore <jmoore@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-07-17 03:25:29 +0000
committerjmoore <jmoore@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-07-17 03:25:29 +0000
commit1d845c80795563c69fe52c086ca9ea526e5f6891 (patch)
tree00ef81dfe8f0846fb4598427eaa893ac8d80b365
parentb1bf9e4afbcb2bade017d9e2f15f774b86370884 (diff)
downloadATCD-1d845c80795563c69fe52c086ca9ea526e5f6891.tar.gz
ss
-rw-r--r--ACE/ace/PIP_Active_IO_Handler.h54
-rw-r--r--ACE/ace/TP_Reactor.h78
-rw-r--r--ACE/ace/ace.mpc27
-rw-r--r--ACE/ace/ace_message_table.binbin28 -> 27 bytes
4 files changed, 119 insertions, 40 deletions
diff --git a/ACE/ace/PIP_Active_IO_Handler.h b/ACE/ace/PIP_Active_IO_Handler.h
new file mode 100644
index 00000000000..b50b606b2e2
--- /dev/null
+++ b/ACE/ace/PIP_Active_IO_Handler.h
@@ -0,0 +1,54 @@
+ /**
+ * @file PIP_Active_IO_Handler.h
+ *
+ * // $Id$
+ *
+ * @author John Moore <ljohn7@gmail.com>
+ *
+ * This file contains the specification for a class
+ * that manages network I/O in a dedicated thread
+*/
+
+
+#ifndef _PIP_ACTIVE_IO_HANDLER_H_
+#define _PIP_ACTIVE_IO_HANDLER_H_
+
+#include "ace/PIP_IO_Handler.h"
+
+/**
+ * @class ACE_PIP_Active_IO_Handler
+ *
+ * @brief Performs network I/O in a dedicated thread
+ *
+ * @author John Moore <ljohn7@gmail.com>
+ */
+class ACE_Export ACE_PIP_Active_IO_Handler :
+ public ACE_PIP_IO_Handler
+{
+ public:
+
+ /// Constructor
+ ACE_PIP_Active_IO_Handler ();
+
+ /// Enqueue a message to be sent
+ virtual int put_message (ACE_PIP_Protocol_Message* message);
+
+ /// Closes all remote connections.
+ virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask);
+
+ /// Performs message I/O
+ virtual int svc();
+
+ /// Shuts down the service. Result is handler deactivated and
+ /// deleted
+ void shutdown_svc();
+
+ virtual int open(void* = 0);
+
+ private:
+
+ bool shutdown_;
+ ACE_Mutex shutdown_lock_;
+};
+
+#endif /* _PIP_Active_IO_Handler_H_ */
diff --git a/ACE/ace/TP_Reactor.h b/ACE/ace/TP_Reactor.h
index d90474252c5..d8bbf111dd2 100644
--- a/ACE/ace/TP_Reactor.h
+++ b/ACE/ace/TP_Reactor.h
@@ -9,15 +9,15 @@
* The ACE_TP_Reactor (aka, Thread Pool Reactor) uses the
* Leader/Followers pattern to demultiplex events among a pool of
* threads. When using a thread pool reactor, an application
- * pre-spawns a _fixed_ number of threads. When these threads
- * invoke the ACE_TP_Reactor's <handle_events> method, one thread
+ * pre-spawns a fixed number of threads. When these threads
+ * invoke the ACE_TP_Reactor's handle_events() method, one thread
* will become the leader and wait for an event. The other
* follower threads will queue up waiting for their turn to become
* the leader. When an event occurs, the leader will pick a
* follower to become the leader and go on to handle the event.
* The consequence of using ACE_TP_Reactor is the amortization of
- * the costs used to creating threads. The context switching cost
- * will also reduce. More over, the total resources used by
+ * the costs used to create threads. The context switching cost
+ * will also reduce. Moreover, the total resources used by
* threads are bounded because there are a fixed number of threads.
*
* @author Irfan Pyarali <irfan@cs.wustl.edu>
@@ -140,42 +140,43 @@ private:
/**
* @class ACE_TP_Reactor
*
- * @brief Specialization of Select Reactor to support thread-pool
+ * @brief Specialization of ACE_Select_Reactor to support thread-pool
* based event dispatching.
*
- * One of the short comings of the Select_Reactor in ACE is that it
- * did not support a thread pool based event dispatching model,
- * similar to the one in WFMO_Reactor. In Select_Reactor, only thread
- * can be blocked in <handle_events> at any given time.
+ * One of the shortcomings of the ACE_Select_Reactor is that it
+ * does not support a thread pool-based event dispatching model,
+ * similar to the one in ACE_WFMO_Reactor. In ACE_Select_Reactor, only
+ * thread can call handle_events() at any given time. ACE_TP_Reactor
+ * removes this short-coming.
*
- * A new Reactor has been added to ACE that removes this short-coming.
- * TP_Reactor is a specialization of Select Reactor to support
- * thread-pool based event dispatching. This Reactor takes advantage
- * of the fact that events reported by <select> are persistent if not
+ * ACE_TP_Reactor is a specialization of ACE_Select_Reactor to support
+ * thread pool-based event dispatching. This reactor takes advantage
+ * of the fact that events reported by @c select() are persistent if not
* acted upon immediately. It works by remembering the event handler
- * that just got activated, releasing the internal lock (so that some
- * other thread can start waiting in the event loop) and then
- * dispatching the event handler outside the context of the Reactor
- * lock. After the event handler has been dispatched the event handler is
- * resumed again. Don't call remove_handler() from the handle_x methods,
- * instead return -1.
+ * which was just activated, suspending it for further I/O activities,
+ * releasing the internal lock (so that another thread can start waiting
+ * in the event loop) and then dispatching the event's handler outside the
+ * scope of the reactor lock. After the event handler has been dispatched
+ * the event handler is resumed for further I/O activity.
*
- * This Reactor is best suited for situations when the callbacks to
- * event handlers can take arbitrarily long and/or a number of threads
- * are available to run the event loops. Note that callback code in
- * Event Handlers (e.g. Event_Handler::handle_input) does not have to
- * be modified or made thread-safe for this Reactor. This is because
- * an activated Event Handler is suspended in the Reactor before the
- * upcall is made and resumed after the upcall completes. Therefore,
- * one Event Handler cannot be called by multiple threads
- * simultaneously.
+ * This reactor implementation is best suited for situations when the
+ * callbacks to event handlers can take arbitrarily long and/or a number
+ * of threads are available to run the event loop. Note that I/O-processing
+ * callback code in event handlers (e.g. handle_input()) does not have to
+ * be modified or made thread-safe for this reactor. This is because
+ * before an I/O event is dispatched to an event handler, the handler is
+ * suspended; it is resumed by the reactor after the upcall completes.
+ * Therefore, multiple I/O events will not be made to one event handler
+ * multiple threads simultaneously. This suspend/resume protection does not
+ * apply to either timers scheduled with the reactor or to notifications
+ * requested via the reactor. When using timers and/or notifications you
+ * must provide proper protection for your class in the context of multiple
+ * threads.
*/
class ACE_Export ACE_TP_Reactor : public ACE_Select_Reactor
{
public:
- // = Initialization and termination methods.
-
/// Initialize ACE_TP_Reactor with the default size.
ACE_TP_Reactor (ACE_Sig_Handler * = 0,
ACE_Timer_Queue * = 0,
@@ -197,8 +198,6 @@ public:
int mask_signals = 1,
int s_queue = ACE_Select_Reactor_Token::FIFO);
- // = Event loop drivers.
-
/**
* This event loop driver that blocks for @a max_wait_time before
* returning. It will return earlier if timer events, I/O events,
@@ -212,9 +211,9 @@ public:
* application wishes to handle events for some fixed amount of
* time.
*
- * Returns the total number of ACE_Event_Handlers that were
- * dispatched, 0 if the @a max_wait_time elapsed without dispatching
- * any handlers, or -1 if something goes wrong.
+ * @return The total number of events that were dispatched; 0 if the
+ * @a max_wait_time elapsed without dispatching any handlers, or -1
+ * if an error occurs (check @c errno for more information).
*/
virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
@@ -229,13 +228,12 @@ public:
/// Called from handle events
static void no_op_sleep_hook (void *);
- // = Any thread can perform a <handle_events>, override the owner()
- // methods to avoid the overhead of setting the owner thread.
-
- /// Set the new owner of the thread and return the old owner.
+ /// The ACE_TP_Reactor implementation does not have a single owner thread.
+ /// Attempts to set the owner explicitly are ignored. The reported owner
+ /// thread is the current Leader in the pattern.
virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id = 0);
- /// Return the current owner of the thread.
+ /// Return the thread ID of the current Leader.
virtual int owner (ACE_thread_t *t_id);
/// Declare the dynamic allocation hooks.
diff --git a/ACE/ace/ace.mpc b/ACE/ace/ace.mpc
index 20f78bef5f0..4a4ef0d66f3 100644
--- a/ACE/ace/ace.mpc
+++ b/ACE/ace/ace.mpc
@@ -32,6 +32,7 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca
Barrier.cpp
Base_Thread_Adapter.cpp
Based_Pointer_Repository.cpp
+ Basic_P_Strategy.cpp
Basic_Stats.cpp
Basic_Types.cpp
Capabilities.cpp
@@ -51,6 +52,7 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca
Copy_Disabled.cpp
Countdown_Time.cpp
Date_Time.cpp
+ DA_Strategy_Base.cpp
DEV.cpp
DEV_Addr.cpp
DEV_Connector.cpp
@@ -90,7 +92,9 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca
IO_Cntl_Msg.cpp
IOStream.cpp
IPC_SAP.cpp
+ k_Efficient_P_Strategy.cpp
Lib_Find.cpp
+ Live_P_Strategy.cpp
Local_Memory_Pool.cpp
Lock.cpp
Log_Msg.cpp
@@ -123,6 +127,7 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca
Method_Request.cpp
MMAP_Memory_Pool.cpp
Msg_WFMO_Reactor.cpp
+ MT_Priority_Reactor.cpp
Multihomed_INET_Addr.cpp
Mutex.cpp
Netlink_Addr.cpp
@@ -175,6 +180,15 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca
PI_Malloc.cpp
Ping_Socket.cpp
Pipe.cpp
+ PIP_Active_IO_Handler.cpp
+ PIP_Connection_Manager.cpp
+ PIP_DA_Strategy_Adapter.cpp
+ PIP_Dispatcher.cpp
+ PIP_Invocation_Manager.cpp
+ PIP_IO_Handler.cpp
+ PIP_Messages.cpp
+ PIP_Message_Handler.cpp
+ PIP_Reactive_IO_Handler.cpp
POSIX_Asynch_IO.cpp
POSIX_CB_Proactor.cpp
POSIX_Proactor.cpp
@@ -375,9 +389,11 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca
Header_Files {
ACE_export.h
Array.h
+ Basic_P_Strategy.h
Bound_Ptr.h
CORBA_macros.h
Condition_T.h
+ DA_Strategy_Base.h
Default_Constants.h
Exception_Macros.h
Global_Macros.h
@@ -386,12 +402,14 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca
Handle_Gobbler.h
If_Then_Else.h
IO_Cntl_Msg.h
+ k_Efficient_P_Strategy.h
Lock_Adapter_T.h
Log_Priority.h
Malloc_Base.h
Method_Object.h
Memory_Pool.h
Min_Max.h
+ MT_Priority_Reactor.h
Netlink_Addr.h
Null_Barrier.h
Null_Condition.h
@@ -406,6 +424,15 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca
OS_Thread_Adapter.h
Object_Manager_Base.h
Pair.h
+ PIP_Active_IO_Handler.h
+ PIP_Connection_Manager.h
+ PIP_DA_Strategy_Adapter.h
+ PIP_Dispatcher.h
+ PIP_Invocation_Manager.h
+ PIP_IO_Handler.h
+ PIP_Messages.h
+ PIP_Message_Handler.h
+ PIP_Reactive_IO_Handler.h
Proactor_Impl.h
Reactor_Impl.h
Reactor_Timer_Interface.h
diff --git a/ACE/ace/ace_message_table.bin b/ACE/ace/ace_message_table.bin
index 6ac08e5dc69..f70e610b110 100644
--- a/ACE/ace/ace_message_table.bin
+++ b/ACE/ace/ace_message_table.bin
Binary files differ