00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_TP_Custom_Synch_Request.h 00006 * 00007 * $Id: CSD_TP_Custom_Synch_Request.h 71473 2006-03-10 07:19:20Z jtc $ 00008 * 00009 * @author Tim Bradley <bradley_t@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_CSD_TP_CUSTOM_SYNCH_REQUEST_H 00014 #define TAO_CSD_TP_CUSTOM_SYNCH_REQUEST_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CSD_ThreadPool/CSD_TP_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/CSD_ThreadPool/CSD_TP_Custom_Request.h" 00025 #include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 namespace TAO 00030 { 00031 namespace CSD 00032 { 00033 00034 class TP_Custom_Synch_Request; 00035 typedef TAO_Intrusive_Ref_Count_Handle<TP_Custom_Synch_Request> 00036 TP_Custom_Synch_Request_Handle; 00037 00038 /** 00039 * @class TP_Custom_Synch_Request 00040 * 00041 * @brief Base class for "queue-able", Custom (non-CORBA), 00042 * Synchronous requests. 00043 * 00044 * TBD - Add description 00045 * 00046 */ 00047 class TAO_CSD_TP_Export TP_Custom_Synch_Request : public TP_Custom_Request 00048 { 00049 public: 00050 00051 /// Constructor. 00052 TP_Custom_Synch_Request(TP_Custom_Request_Operation* op, 00053 TP_Servant_State* servant_state); 00054 00055 /// Virtual Destructor. 00056 virtual ~TP_Custom_Synch_Request(); 00057 00058 /// Wait until the request has been executed (and completes), or 00059 /// until it has been cancelled. Returns true if the request has 00060 /// been executed/completed, and returns false if the request has 00061 /// been cancelled. 00062 bool wait(); 00063 00064 00065 protected: 00066 00067 /// Dispatch the request to the servant. 00068 virtual void dispatch_i(); 00069 00070 /// Cancel the request. 00071 virtual void cancel_i(); 00072 00073 00074 private: 00075 00076 /// Helper used to block and unblock the thread that invokes our 00077 /// wait() method. 00078 TP_Synch_Helper synch_helper_; 00079 }; 00080 00081 } 00082 } 00083 00084 TAO_END_VERSIONED_NAMESPACE_DECL 00085 00086 #if defined (__ACE_INLINE__) 00087 # include "tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.inl" 00088 #endif /* __ACE_INLINE__ */ 00089 00090 #include /**/ "ace/post.h" 00091 00092 #endif /* TAO_CSD_TP_CUSTOM_SYNCH_REQUEST_H */