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

Handle_Set.cpp

Go to the documentation of this file.
00001 #include "ace_pch.h"
00002 // Handle_Set.cpp
00003 // $Id: Handle_Set.cpp,v 1.1.1.4.2.1 2003/03/13 19:44:21 chad Exp $
00004 
00005 #include "ace/Handle_Set.h"
00006 #include "ace/Log_Msg.h"
00007 
00008 #if !defined (__ACE_INLINE__)
00009 #include "ace/Handle_Set.i"
00010 #endif /* __ACE_INLINE__ */
00011 
00012 ACE_RCSID(ace, Handle_Set, "$Id: Handle_Set.cpp,v 1.1.1.4.2.1 2003/03/13 19:44:21 chad Exp $")
00013 
00014 ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set)
00015 
00016 #if defined (__BORLANDC__) && !defined (ACE_WIN32)
00017 // The Borland C++ compiler on Linux also doesn't have fds_bits, but has __fds_bits.
00018 #define fds_bits __fds_bits
00019 #endif
00020 
00021 #if defined (linux) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !defined (_XOPEN_SOURCE)
00022   // XPG4.2 requires the fds_bits member name, so it is not enabled by
00023   // default on Linux/glibc-2.1.x systems.  Instead use "__fds_bits."
00024   // Ugly, but "what are you going to do?" 8-)
00025 #define fds_bits __fds_bits
00026 #endif  /* linux && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !_XOPEN_SOURCE */
00027 
00028 void
00029 ACE_Handle_Set::dump (void) const
00030 {
00031   ACE_TRACE ("ACE_Handle_Set::dump");
00032 
00033   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00034 
00035   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nsize_ = %d"), this->size_));
00036   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nmax_handle_ = %d"), this->max_handle_));
00037   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n[ ")));
00038 
00039 #if defined (ACE_WIN32)
00040   for (size_t i = 0; i < (size_t) this->mask_.fd_count + 1; i++)
00041     ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" %x "), this->mask_.fd_array[i]));
00042 #else /* !ACE_WIN32 */
00043   for (ACE_HANDLE i = 0; i < this->max_handle_ + 1; i++)
00044     if (this->is_set (i))
00045       ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" %d "), i));
00046 #endif /* ACE_WIN32 */
00047 
00048   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" ]\n")));
00049   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00050 }
00051 
00052 // Table that maps bytes to counts of the enabled bits in each value
00053 // from 0 to 255,
00054 //
00055 // nbits_[0] == 0
00056 //
00057 // because there are no bits enabled for the value 0.
00058 //
00059 // nbits_[5] == 2
00060 //
00061 // because there are 2 bits enabled in the value 5, i.e., it's
00062 // 101 in binary.
00063 
00064 const char ACE_Handle_Set::nbits_[256] =
00065 {
00066   0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
00067   1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
00068   1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
00069   2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
00070   1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
00071   2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
00072   2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
00073   3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
00074   1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
00075   2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
00076   2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
00077   3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
00078   2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
00079   3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
00080   3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
00081   4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
00082 
00083 // Constructor, initializes the bitmask to all 0s.
00084 
00085 ACE_Handle_Set::ACE_Handle_Set (void)
00086 {
00087   ACE_TRACE ("ACE_Handle_Set::ACE_Handle_Set");
00088   this->reset ();
00089 }
00090 
00091 ACE_Handle_Set::ACE_Handle_Set (const ACE_FD_SET_TYPE &fd_mask)
00092 {
00093   ACE_TRACE ("ACE_Handle_Set::ACE_Handle_Set");
00094   this->reset ();
00095   ACE_OS::memcpy ((void *) &this->mask_,
00096                   (void *) &fd_mask,
00097                   sizeof this->mask_);
00098 #if !defined (ACE_WIN32)
00099   this->sync (ACE_Handle_Set::MAXSIZE);
00100 #if defined (ACE_HAS_BIG_FD_SET)
00101   this->min_handle_ = 0;
00102 #endif /* ACE_HAS_BIG_FD_SET */
00103 #endif /* !ACE_WIN32 */
00104 }
00105 
00106 // Counts the number of bits enabled in N.  Uses a table lookup to
00107 // speed up the count.
00108 
00109 int
00110 ACE_Handle_Set::count_bits (u_long n)
00111 {
00112 
00113  ACE_TRACE ("ACE_Handle_Set::count_bits");
00114 #if defined (ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT)
00115   register int rval = 0;
00116 
00117   // Count the number of enabled bits in <n>.  This algorithm is very
00118   // fast, i.e., O(enabled bits in n).
00119 
00120   for (register u_long m = n;
00121        m != 0;
00122        m &= m - 1)
00123     rval++;
00124 
00125   return rval;
00126 #else
00127    return (ACE_Handle_Set::nbits_[n & 0xff]
00128           + ACE_Handle_Set::nbits_[(n >> 8) & 0xff]
00129           + ACE_Handle_Set::nbits_[(n >> 16) & 0xff]
00130           + ACE_Handle_Set::nbits_[(n >> 24) & 0xff]);
00131 #endif /* ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT */
00132 }
00133 
00134 #if defined (ACE_HAS_BIG_FD_SET)
00135 // Find the bit position counting from right to left worst case
00136 // (1<<31) is 8.
00137 
00138 int
00139 ACE_Handle_Set::bitpos (u_long bit)
00140 {
00141   register int l = 0;
00142   register u_long n = bit - 1;
00143 
00144   // This is a fast count method when have the most significative bit.
00145 
00146   while (n >> 8)
00147     {
00148       n >>= 8;
00149       l += 8;
00150     }
00151 
00152   // Is greater than 15?
00153   if (n & 16)
00154     {
00155       n >>= 4;
00156       l += 4;
00157     }
00158 
00159   // Count number remaining bits.
00160   while (n != 0)
00161     {
00162       n &= n - 1;
00163       l++;
00164     }
00165   return l;
00166 }
00167 #endif /* ACE_HAS_BIG_FD_SET */
00168 
00169 // Synchronize the underlying FD_SET with the MAX_FD and the SIZE.
00170 
00171 #if defined (ACE_USE_SHIFT_FOR_EFFICIENCY)
00172 // These don't work because shifting right 3 bits is not the same as
00173 // dividing by 3, e.g., dividing by 8 requires shifting right 3 bits.
00174 // In order to do the shift, we need to calculate the number of bits
00175 // at some point.
00176 #define ACE_DIV_BY_WORDSIZE(x) ((x) >> ((int) ACE_Handle_Set::WORDSIZE))
00177 #define ACE_MULT_BY_WORDSIZE(x) ((x) << ((int) ACE_Handle_Set::WORDSIZE))
00178 #else
00179 #define ACE_DIV_BY_WORDSIZE(x) ((x) / ((int) ACE_Handle_Set::WORDSIZE))
00180 #define ACE_MULT_BY_WORDSIZE(x) ((x) * ((int) ACE_Handle_Set::WORDSIZE))
00181 #endif /* ACE_USE_SHIFT_FOR_EFFICIENCY */
00182 
00183 void
00184 ACE_Handle_Set::sync (ACE_HANDLE max)
00185 {
00186   ACE_TRACE ("ACE_Handle_Set::sync");
00187 #if !defined (ACE_WIN32)
00188   fd_mask *maskp = (fd_mask *)(this->mask_.fds_bits);
00189   this->size_ = 0;
00190 
00191   for (int i = ACE_DIV_BY_WORDSIZE (max - 1);
00192        i >= 0;
00193        i--)
00194     this->size_ += ACE_Handle_Set::count_bits (maskp[i]);
00195 
00196   this->set_max (max);
00197 #else
00198   ACE_UNUSED_ARG (max);
00199 #endif /* !ACE_WIN32 */
00200 }
00201 
00202 // Resets the MAX_FD after a clear of the original MAX_FD.
00203 
00204 void
00205 ACE_Handle_Set::set_max (ACE_HANDLE current_max)
00206 {
00207   ACE_TRACE ("ACE_Handle_Set::set_max");
00208 #if !defined(ACE_WIN32)
00209   fd_mask * maskp = (fd_mask *)(this->mask_.fds_bits);
00210 
00211   if (this->size_ == 0)
00212     this->max_handle_ = ACE_INVALID_HANDLE;
00213   else
00214     {
00215       int i;
00216 
00217       for (i = ACE_DIV_BY_WORDSIZE (current_max - 1);
00218            maskp[i] == 0;
00219            i--)
00220         continue;
00221 
00222 #if defined (ACE_PSOS)
00223       this->max_handle_ = ACE_MULT_BY_WORDSIZE (i);
00224       for (fd_mask val = maskp[i];
00225            (val & ACE_MSB_MASK) != 0;
00226            val = (val << 1))
00227         this->max_handle_++;
00228 #elif 1 /* !defined(ACE_HAS_BIG_FD_SET) */
00229       this->max_handle_ = ACE_MULT_BY_WORDSIZE (i);
00230       for (fd_mask val = maskp[i];
00231            (val & ~1) != 0; // This obscure code is needed since "bit 0" is in location 1...
00232            val = (val >> 1) & ACE_MSB_MASK)
00233         this->max_handle_++;
00234 #else
00235       register u_long val = this->mask_.fds_bits[i];
00236       this->max_handle_ = ACE_MULT_BY_WORDSIZE (i)
00237         + ACE_Handle_Set::bitpos(val & ~(val - 1));
00238 #endif /* 1 */
00239     }
00240 
00241   // Do some sanity checking...
00242   if (this->max_handle_ >= ACE_Handle_Set::MAXSIZE)
00243     this->max_handle_ = ACE_Handle_Set::MAXSIZE - 1;
00244 #else
00245   ACE_UNUSED_ARG (current_max);
00246 #endif /* !ACE_WIN32 */
00247 }
00248 
00249 ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set_Iterator)
00250 
00251 void
00252 ACE_Handle_Set_Iterator::dump (void) const
00253 {
00254   ACE_TRACE ("ACE_Handle_Set_Iterator::dump");
00255 
00256   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00257 #if defined(ACE_WIN32) || !defined(ACE_HAS_BIG_FD_SET)
00258   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nhandle_index_ = %d"), this->handle_index_));
00259 #elif defined(ACE_HAS_BIG_FD_SET)
00260   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nword_max_ = %d"), this->word_max_));
00261   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nword_val_ = %d"), this->word_val_));
00262 #endif
00263   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nword_num_ = %d"), this->word_num_));
00264   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00265 }
00266 
00267 ACE_HANDLE
00268 ACE_Handle_Set_Iterator::operator () (void)
00269 {
00270   ACE_TRACE ("ACE_Handle_Set_Iterator::operator");
00271 #if defined (ACE_WIN32)
00272   if (this->handle_index_ < this->handles_.mask_.fd_count)
00273     // Return the handle and advance the iterator.
00274     return (ACE_HANDLE) this->handles_.mask_.fd_array[this->handle_index_++];
00275   else
00276     return ACE_INVALID_HANDLE;
00277 
00278 #elif !defined (ACE_HAS_BIG_FD_SET) /* !ACE_WIN32 */
00279   // No sense searching further than the max_handle_ + 1;
00280   ACE_HANDLE maxhandlep1 = this->handles_.max_handle_ + 1;
00281 
00282   // HP-UX 11 plays some games with the fd_mask type - fd_mask is
00283   // defined as an int_32t, but the fds_bits is an array of longs.
00284   // This makes plainly indexing through the array by hand tricky,
00285   // since the FD_* macros treat the array as int32_t.  So the bits
00286   // are in the right place for int32_t, even though the array is
00287   // long.  This, they say, is to preserve the same in-memory layout
00288   // for 32-bit and 64-bit processes.  So, we play the same game as
00289   // the FD_* macros to get the bits right.  On all other systems,
00290   // this amounts to practically a NOP, since this is what would have
00291   // been done anyway, without all this type jazz.
00292   fd_mask * maskp = (fd_mask *)(this->handles_.mask_.fds_bits);
00293 
00294   if (this->handle_index_ >= maxhandlep1)
00295     // We've seen all the handles we're interested in seeing for this
00296     // iterator.
00297     return ACE_INVALID_HANDLE;
00298   else
00299     {
00300       ACE_HANDLE result = this->handle_index_;
00301 
00302       // Increment the iterator and advance to the next bit in this
00303       // word.
00304       this->handle_index_++;
00305 #  if defined (ACE_PSOS)
00306       this->word_val_ = (this->word_val_ << 1);
00307 #  else
00308       this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
00309 #  endif /* ACE_PSOS */
00310 
00311       // If we've examined all the bits in this word, we'll go onto
00312       // the next word.
00313 
00314       if (this->word_val_ == 0)
00315         {
00316           // Start the handle_index_ at the beginning of the next word
00317           // and then loop until we've found the first non-zero bit or
00318           // we run past the <maxhandlep1> of the bitset.
00319 
00320           for (this->handle_index_ = ACE_MULT_BY_WORDSIZE(++this->word_num_);
00321                this->handle_index_ < maxhandlep1
00322                  && maskp[this->word_num_] == 0;
00323                this->word_num_++)
00324             this->handle_index_ += ACE_Handle_Set::WORDSIZE;
00325 
00326           // If the bit index becomes >= the maxhandlep1 that means
00327           // there weren't any more bits set that we want to consider.
00328           // Therefore, we'll just store the maxhandlep1, which will
00329           // cause <operator()> to return <ACE_INVALID_HANDLE>
00330           // immediately next time it's called.
00331           if (this->handle_index_ >= maxhandlep1)
00332             {
00333               this->handle_index_ = maxhandlep1;
00334               return result;
00335             }
00336           else
00337             // Load the bits of the next word.
00338             this->word_val_ = maskp[this->word_num_];
00339         }
00340 
00341       // Loop until we get <word_val_> to have its least significant
00342       // bit enabled, keeping track of which <handle_index> this
00343       // represents (this information is used by subsequent calls to
00344       // <operator()>).
00345 
00346 #  if defined (ACE_PSOS) // bits are in reverse order, MSB (sign bit) = bit 0.
00347       for (;
00348            this->word_val_ > 0;
00349            this->word_val_ = (this->word_val_ << 1))
00350         this->handle_index_++;
00351 #  else
00352       for (;
00353            ACE_BIT_DISABLED (this->word_val_, 1);
00354            this->handle_index_++)
00355         this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
00356 #  endif /* ACE_PSOS */
00357 
00358       return result;
00359     }
00360 #else /* !ACE_HAS_BIG_FD_SET */
00361    // Find the first word in fds_bits with bit on
00362    register u_long lsb = this->word_val_;
00363 
00364    if (lsb == 0)
00365      {
00366        do
00367          {
00368            // We have exceeded the word count in Handle_Set?
00369            if (++this->word_num_ >= this->word_max_)
00370              return ACE_INVALID_HANDLE;
00371 
00372            lsb = this->handles_.mask_.fds_bits[this->word_num_];
00373          }
00374        while (lsb == 0);
00375 
00376        // Set index to word boundary.
00377        this->handle_index_ = ACE_MULT_BY_WORDSIZE(this->word_num_);
00378 
00379        // Put new word_val.
00380        this->word_val_ = lsb;
00381 
00382        // Find the least significative bit.
00383        lsb &= ~(lsb - 1);
00384 
00385        // Remove least significative bit.
00386        this->word_val_ ^= lsb;
00387 
00388        // Save to calculate bit distance.
00389        this->oldlsb_ = lsb;
00390 
00391        // Move index to least significative bit.
00392        while (lsb >>= 1)
00393          this->handle_index_++;
00394      }
00395    else
00396      {
00397         // Find the least significative bit.
00398         lsb &= ~(lsb - 1);
00399 
00400         // Remove least significative bit.
00401         this->word_val_ ^= lsb;
00402 
00403         register u_long n = lsb - this->oldlsb_;
00404 
00405         // Move index to bit distance between new lsb and old lsb.
00406         do
00407           {
00408             this->handle_index_++;
00409             n &= n >> 1;
00410           }
00411         while (n != 0);
00412 
00413         this->oldlsb_ = lsb;
00414       }
00415 
00416    return this->handle_index_;
00417 #endif /* ACE_WIN32 */
00418 }
00419 
00420 void
00421 ACE_Handle_Set_Iterator::operator++ (void)
00422 {
00423   ACE_TRACE ("ACE_Handle_Set_Iterator::operator++");
00424 
00425   // This is now a no-op.
00426 }
00427 
00428 ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs)
00429   : handles_ (hs),
00430 #if !defined (ACE_HAS_BIG_FD_SET) || defined (ACE_WIN32)
00431     handle_index_ (0),
00432     word_num_ (-1)
00433 #elif defined (ACE_HAS_BIG_FD_SET)
00434     oldlsb_ (0),
00435     word_max_ (hs.max_handle_ == ACE_INVALID_HANDLE
00436                ? 0
00437                : ((ACE_DIV_BY_WORDSIZE (hs.max_handle_)) + 1))
00438 #endif /* ACE_HAS_BIG_FD_SET */
00439 {
00440   ACE_TRACE ("ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator");
00441 #if !defined (ACE_WIN32) && !defined (ACE_HAS_BIG_FD_SET)
00442   // No sense searching further than the max_handle_ + 1;
00443   ACE_HANDLE maxhandlep1 =
00444     this->handles_.max_handle_ + 1;
00445 
00446   fd_mask *maskp =
00447     (fd_mask *)(this->handles_.mask_.fds_bits);
00448 
00449   // Loop until we've found the first non-zero bit or we run past the
00450   // <maxhandlep1> of the bitset.
00451   while (this->handle_index_ < maxhandlep1
00452          && maskp[++this->word_num_] == 0)
00453     this->handle_index_ += ACE_Handle_Set::WORDSIZE;
00454 
00455   // If the bit index becomes >= the maxhandlep1 that means there
00456   // weren't any bits set.  Therefore, we'll just store the
00457   // maxhandlep1, which will cause <operator()> to return
00458   // <ACE_INVALID_HANDLE> immediately.
00459   if (this->handle_index_ >= maxhandlep1)
00460     this->handle_index_ = maxhandlep1;
00461   else
00462     // Loop until we get <word_val_> to have its least significant bit
00463     // enabled, keeping track of which <handle_index> this represents
00464     // (this information is used by <operator()>).
00465 #  if defined (ACE_PSOS) // bits are in reverse order, MSB (sign bit) = bit 0.
00466     for (this->word_val_ = maskp[this->word_num_];
00467          this->word_val_ > 0;
00468          this->word_val_ = (this->word_val_ << 1))
00469       this->handle_index_++;
00470 #  else
00471     for (this->word_val_ = maskp[this->word_num_];
00472          ACE_BIT_DISABLED (this->word_val_, 1)
00473            && this->handle_index_ < maxhandlep1;
00474          this->handle_index_++)
00475       this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
00476 #  endif /* ACE_PSOS */
00477 #elif !defined (ACE_WIN32) && defined (ACE_HAS_BIG_FD_SET)
00478     if (this->word_max_==0)
00479       {
00480         this->word_num_ = -1;
00481         this->word_val_ = 0;
00482       }
00483     else
00484       {
00485         this->word_num_ =
00486           ACE_DIV_BY_WORDSIZE (this->handles_.min_handle_) - 1;
00487         this->word_val_ = 0;
00488       }
00489 #endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */
00490 }
00491 
00492 
00493 void
00494 ACE_Handle_Set_Iterator::reset_state (void)
00495 {
00496   ACE_TRACE ("ACE_Handle_Set_Iterator::reset_state");
00497 
00498 #if !defined (ACE_HAS_BIG_FD_SET) || defined (ACE_WIN32)
00499   this->handle_index_  = 0;
00500   this->word_num_ = -1;
00501 #elif defined (ACE_HAS_BIG_FD_SET)
00502   this->oldlsb_ = 0;
00503   this->word_max_  =
00504     this->handles_.max_handle_ == ACE_INVALID_HANDLE  ? 0
00505     : ((ACE_DIV_BY_WORDSIZE (this->handles_.max_handle_)) + 1);
00506 #endif /* ACE_HAS_BIG_FD_SET */
00507 
00508 #if !defined (ACE_WIN32) && !defined (ACE_HAS_BIG_FD_SET)
00509   // No sense searching further than the max_handle_ + 1;
00510   ACE_HANDLE maxhandlep1 =
00511     this->handles_.max_handle_ + 1;
00512 
00513   fd_mask *maskp =
00514     (fd_mask *)(this->handles_.mask_.fds_bits);
00515 
00516   // Loop until we've found the first non-zero bit or we run past the
00517   // <maxhandlep1> of the bitset.
00518   while (this->handle_index_ < maxhandlep1
00519          && maskp[++this->word_num_] == 0)
00520     this->handle_index_ += ACE_Handle_Set::WORDSIZE;
00521 
00522   // If the bit index becomes >= the maxhandlep1 that means there
00523   // weren't any bits set.  Therefore, we'll just store the
00524   // maxhandlep1, which will cause <operator()> to return
00525   // <ACE_INVALID_HANDLE> immediately.
00526   if (this->handle_index_ >= maxhandlep1)
00527     this->handle_index_ = maxhandlep1;
00528   else
00529     // Loop until we get <word_val_> to have its least significant bit
00530     // enabled, keeping track of which <handle_index> this represents
00531     // (this information is used by <operator()>).
00532 #  if defined (ACE_PSOS) // bits are in reverse order, MSB (sign bit) = bit 0.
00533     for (this->word_val_ = maskp[this->word_num_];
00534          this->word_val_ > 0;
00535          this->word_val_ = (this->word_val_ << 1))
00536       this->handle_index_++;
00537 #  else
00538     for (this->word_val_ = maskp[this->word_num_];
00539          ACE_BIT_DISABLED (this->word_val_, 1)
00540            && this->handle_index_ < maxhandlep1;
00541          this->handle_index_++)
00542       this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
00543 #  endif /* ACE_PSOS */
00544 #elif !defined (ACE_WIN32) && defined (ACE_HAS_BIG_FD_SET)
00545     if (this->word_max_==0)
00546       {
00547         this->word_num_ = -1;
00548         this->word_val_ = 0;
00549       }
00550     else
00551       {
00552         this->word_num_ =
00553           ACE_DIV_BY_WORDSIZE (this->handles_.min_handle_) - 1;
00554         this->word_val_ = 0;
00555       }
00556 #endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */
00557 }

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