Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Message_Queue.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: Message_Queue.i,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00003 
00004 ACE_INLINE
00005 ACE_Message_Queue_Base::ACE_Message_Queue_Base (void)
00006 {
00007 }
00008 
00009 ACE_INLINE
00010 ACE_Message_Queue_Base::~ACE_Message_Queue_Base (void)
00011 {
00012 }
00013 
00014 ACE_INLINE int
00015 ACE_Message_Queue_Base::state (void)
00016 {
00017   ACE_TRACE ("ACE_Message_Queue_Base::state");
00018 
00019   return this->state_;
00020 }
00021 
00022 #if defined (VXWORKS)
00023 // Specialization to use native VxWorks Message Queues.
00024 
00025 ACE_INLINE MSG_Q_ID
00026 ACE_Message_Queue_Vx::msgq ()
00027 {
00028   // Hijack the tail_ field to store the MSG_Q_ID.
00029   return ACE_reinterpret_cast (MSG_Q_ID, tail_);
00030 }
00031 
00032 ACE_INLINE int
00033 ACE_Message_Queue_Vx::is_empty_i (void)
00034 {
00035   ACE_TRACE ("ACE_Message_Queue_Vx::is_empty_i");
00036   return ::msgQNumMsgs (msgq ()) == 0;
00037 }
00038 
00039 ACE_INLINE int
00040 ACE_Message_Queue_Vx::is_full_i (void)
00041 {
00042   ACE_TRACE ("ACE_Message_Queue_Vx::is_full_i");
00043   return ::msgQNumMsgs (msgq ()) >= max_messages_;
00044 }
00045 
00046 ACE_INLINE size_t
00047 ACE_Message_Queue_Vx::high_water_mark (void)
00048 {
00049   ACE_TRACE ("ACE_Message_Queue_Vx::high_water_mark");
00050   ACE_NOTSUP_RETURN ((size_t) -1);
00051 }
00052 
00053 ACE_INLINE void
00054 ACE_Message_Queue_Vx::high_water_mark (size_t)
00055 {
00056   ACE_TRACE ("ACE_Message_Queue_Vx::high_water_mark");
00057   ACE_NOTSUP;
00058 }
00059 
00060 ACE_INLINE size_t
00061 ACE_Message_Queue_Vx::low_water_mark (void)
00062 {
00063   ACE_TRACE ("ACE_Message_Queue_Vx::low_water_mark");
00064   // Don't need to guard, because this is fixed.
00065 
00066   ACE_NOTSUP_RETURN ((size_t) -1);
00067 }
00068 
00069 ACE_INLINE void
00070 ACE_Message_Queue_Vx::low_water_mark (size_t)
00071 {
00072   ACE_TRACE ("ACE_Message_Queue_Vx::low_water_mark");
00073   ACE_NOTSUP;
00074 }
00075 
00076 ACE_INLINE size_t
00077 ACE_Message_Queue_Vx::message_bytes (void)
00078 {
00079   ACE_TRACE ("ACE_Message_Queue_Vx::message_bytes");
00080   ACE_NOTSUP_RETURN ((size_t) -1);
00081 }
00082 
00083 ACE_INLINE size_t
00084 ACE_Message_Queue_Vx::message_length (void)
00085 {
00086   ACE_TRACE ("ACE_Message_Queue_Vx::message_length");
00087   ACE_NOTSUP_RETURN ((size_t) -1);
00088 }
00089 
00090 ACE_INLINE int
00091 ACE_Message_Queue_Vx::message_count (void)
00092 {
00093   ACE_TRACE ("ACE_Message_Queue_Vx::message_count");
00094   // Don't need to guard, because this is a system call.
00095 
00096   return ::msgQNumMsgs (msgq ());
00097 }
00098 
00099 ACE_INLINE void
00100 ACE_Message_Queue_Vx::message_bytes (size_t)
00101 {
00102   ACE_TRACE ("ACE_Message_Queue_Vx::message_bytes");
00103   ACE_NOTSUP;
00104 }
00105 
00106 ACE_INLINE void
00107 ACE_Message_Queue_Vx::message_length (size_t)
00108 {
00109   ACE_TRACE ("ACE_Message_Queue_Vx::message_length");
00110   ACE_NOTSUP;
00111 }
00112 
00113 #endif /* VXWORKS */
00114 
00115 #if defined (ACE_WIN32) && (ACE_HAS_WINNT4 != 0)
00116 ACE_INLINE int
00117 ACE_Message_Queue_NT::enqueue_tail (ACE_Message_Block *new_item,
00118                                     ACE_Time_Value *timeout)
00119 {
00120   ACE_TRACE ("ACE_Message_Queue_NT::enqueue_tail");
00121   return this->enqueue (new_item, timeout);
00122 }
00123 
00124 ACE_INLINE int
00125 ACE_Message_Queue_NT::dequeue_head (ACE_Message_Block *&first_item,
00126                                     ACE_Time_Value *timeout)
00127 {
00128   ACE_TRACE ("ACE_Message_Queue_NT::dequeue_head");
00129   return this->dequeue (first_item, timeout);
00130 }
00131 
00132 ACE_INLINE int
00133 ACE_Message_Queue_NT::is_full (void)
00134 {
00135   ACE_TRACE ("ACE_Message_Queue_NT::is_full");
00136   return 0; // Always not full.
00137 }
00138 
00139 ACE_INLINE int
00140 ACE_Message_Queue_NT::is_empty (void)
00141 {
00142   ACE_TRACE ("ACE_Message_Queue_NT::is_empty");
00143   ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0);
00144 
00145   return (this->cur_bytes_ > 0 && this->cur_count_ > 0 ? 1 : 0);
00146 }
00147 
00148 ACE_INLINE size_t
00149 ACE_Message_Queue_NT::message_bytes (void)
00150 {
00151   ACE_TRACE ("ACE_Message_Queue_NT::message_bytes");
00152   // Accessing to size_t must be atomic.
00153   return this->cur_bytes_;
00154 }
00155 
00156 ACE_INLINE size_t
00157 ACE_Message_Queue_NT::message_length (void)
00158 {
00159   ACE_TRACE ("ACE_Message_Queue_NT::message_length");
00160   // Accessing to size_t must be atomic.
00161   return this->cur_length_;
00162 }
00163 
00164 ACE_INLINE int
00165 ACE_Message_Queue_NT::message_count (void)
00166 {
00167   ACE_TRACE ("ACE_Message_Queue_NT::message_count");
00168   // Accessing to size_t must be atomic.
00169   return this->cur_count_;
00170 }
00171 
00172 ACE_INLINE void
00173 ACE_Message_Queue_NT::message_bytes (size_t new_value)
00174 {
00175   ACE_TRACE ("ACE_Message_Queue_NT::message_bytes");
00176   ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_);
00177 
00178   this->cur_bytes_ = new_value;
00179 }
00180 
00181 ACE_INLINE void
00182 ACE_Message_Queue_NT::message_length (size_t new_value)
00183 {
00184   ACE_TRACE ("ACE_Message_Queue_NT::message_length");
00185   ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_);
00186 
00187   this->cur_length_ = new_value;
00188 }
00189 
00190 ACE_INLINE DWORD
00191 ACE_Message_Queue_NT::max_threads (void)
00192 {
00193   ACE_TRACE ("ACE_Message_Queue_NT::max_threads");
00194   return this->max_cthrs_;
00195 }
00196 
00197 ACE_INLINE int
00198 ACE_Message_Queue_NT::deactivated (void)
00199 {
00200   ACE_TRACE ("ACE_Message_Queue_NT::deactivated");
00201   // Accessing to int must be atomic.
00202   return this->state_ == ACE_Message_Queue_Base::DEACTIVATED;
00203 }
00204 
00205 ACE_INLINE ACE_HANDLE
00206 ACE_Message_Queue_NT::completion_port (void)
00207 {
00208   ACE_TRACE ("ACE_Message_Queue_NT::completion_port");
00209   return this->completion_port_;
00210 }
00211 
00212 ACE_INLINE int
00213 ACE_Message_Queue_NT::peek_dequeue_head (ACE_Message_Block *&first_item,
00214                                          ACE_Time_Value *timeout)
00215 {
00216   ACE_UNUSED_ARG(first_item);
00217   ACE_UNUSED_ARG(timeout);
00218   ACE_NOTSUP_RETURN (-1);
00219 }
00220 
00221 ACE_INLINE ACE_Notification_Strategy *
00222 ACE_Message_Queue_NT::notification_strategy (void)
00223 {
00224   ACE_NOTSUP_RETURN (0);
00225 }
00226 
00227 ACE_INLINE void
00228 ACE_Message_Queue_NT::notification_strategy (ACE_Notification_Strategy *)
00229 {
00230 }
00231 
00232 #endif /* ACE_WIN32 && ACE_HAS_WINNT4 != 0 */

Generated on Mon Jun 16 11:20:23 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002