code: public synchronized int co_joinCoroutineSet(int coroutineID)
    {
      if(coroutineID>=0)
        {
          if(coroutineID>=m_unreasonableId || m_activeIDs.get(coroutineID))
            return -1;
        }
      else
        {
          // What I want is "Find first clear bit". That doesn't exist.
          // JDK1.2 added "find last set bit", but that doesn't help now.
          coroutineID=0;
          while(coroutineID<m_unreasonableId)
            {
              if(m_activeIDs.get(coroutineID))
                ++coroutineID;
              else
                break;
            }
          if(coroutineID>=m_unreasonableId)
            return -1;
        }
  
      m_activeIDs.set(coroutineID);
      return coroutineID;
    }
docs: <p>Each coroutine in the set managed by a single
  CoroutineManager is identified by a small positive integer. This
  brings up the question of how to manage those integers to avoid
  reuse... since if two coroutines use the same ID number, resuming
  that ID could resume either. I can see arguments for either
  allowing applications to select their own numbers (they may want
  to declare mnemonics via manefest constants) or generating
  numbers on demand.  This routine's intended to support both
  approaches.</p>
  
  <p>%REVIEW% We could use an object as the identifier. Not sure
  it's a net gain, though it would allow the thread to be its own
  ID. Ponder.</p>
  
  @param coroutineID  If >=0, requests that we reserve this number.
  If <0, requests that we find, reserve, and return an available ID
  number.
  
  @return If >=0, the ID number to be used by this coroutine. If <0,
  an error occurred -- the ID requested was already in use, or we
  couldn't assign one without going over the "unreasonable value" mark