(file) Return to MessageQueueService.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/MessageQueueService.cpp between version 1.29 and 1.30

version 1.29, 2002/03/06 21:25:06 version 1.30, 2002/03/07 01:17:56
Line 188 
Line 188 
    return(0);    return(0);
 } }
  
   
   // callback function is responsible for cleaning up all resources
   // including op, op->_callback_node, and op->_callback_ptr
 void MessageQueueService::_handle_async_callback(AsyncOpNode *op) void MessageQueueService::_handle_async_callback(AsyncOpNode *op)
 { {
    return_op(op);     // note that _callback_node may be different from op
      // op->_callback_q is a "this" pointer we can use for static callback methods
      op->_async_callback(op->_callback_node, op->_callback_q, op->_callback_ptr);
 } }
  
  
Line 552 
Line 557 
                                        Uint32 destination)                                        Uint32 destination)
 { {
    PEGASUS_ASSERT(op != 0 );    PEGASUS_ASSERT(op != 0 );
    if ( 0 == (op->_op_dest = MessageQueue::lookup(destination)))     op->lock();
       return false;     op->_op_dest = MessageQueue::lookup(destination);
   
    op->_flags |= (ASYNC_OPFLAGS_FIRE_AND_FORGET | ASYNC_OPFLAGS_FORWARD);    op->_flags |= (ASYNC_OPFLAGS_FIRE_AND_FORGET | ASYNC_OPFLAGS_FORWARD);
    op->_flags &= ~(ASYNC_OPFLAGS_CALLBACK);    op->_flags &= ~(ASYNC_OPFLAGS_CALLBACK);
      op->unlock();
      if ( op->_op_dest == 0 )
         return false;
  
    return  _meta_dispatcher->route_async(op);    return  _meta_dispatcher->route_async(op);
 } }
Line 566 
Line 573 
                                        Uint32 destination,                                        Uint32 destination,
                                        void (*callback)(AsyncOpNode *,                                        void (*callback)(AsyncOpNode *,
                                                         MessageQueue *,                                                         MessageQueue *,
                                                         void *))                                                          void *),
                                          MessageQueue *callback_response_q,
                                          void *callback_ptr)
 { {
    PEGASUS_ASSERT(op != 0 && callback != 0 );    PEGASUS_ASSERT(op != 0 && callback != 0 );
  
    // get the queue handle for the destination    // get the queue handle for the destination
    if ( 0 == (op->_op_dest = MessageQueue::lookup(destination)))  
       return false;  
  
      op->lock();
      op->_op_dest = MessageQueue::lookup(destination);
    op->_flags |= ASYNC_OPFLAGS_CALLBACK;    op->_flags |= ASYNC_OPFLAGS_CALLBACK;
    op->_flags &= ~(ASYNC_OPFLAGS_FIRE_AND_FORGET);    op->_flags &= ~(ASYNC_OPFLAGS_FIRE_AND_FORGET);
    op->_state &= ~ASYNC_OPSTATE_COMPLETE;    op->_state &= ~ASYNC_OPSTATE_COMPLETE;
      // initialize the callback data
      op->_async_callback = callback;
      op->_callback_node = op;
      op->_callback_response_q = callback_response_q;
      op->_callback_ptr = callback_ptr;
      op->_callback_q = this;
   
      op->unlock();
      if(op->_op_dest == 0)
         return false;
  
    return  _meta_dispatcher->route_async(op);    return  _meta_dispatcher->route_async(op);
 } }
Line 601 
Line 620 
       if (mask & message_mask::ha_async)       if (mask & message_mask::ha_async)
          (static_cast<AsyncMessage *>(msg))->op = op;          (static_cast<AsyncMessage *>(msg))->op = op;
    }    }
      op->lock();
      op->_op_dest = MessageQueue::lookup(msg->dest);
    op->_flags |= ASYNC_OPFLAGS_FIRE_AND_FORGET;    op->_flags |= ASYNC_OPFLAGS_FIRE_AND_FORGET;
    op->_flags &= ~(ASYNC_OPFLAGS_CALLBACK | ASYNC_OPFLAGS_SIMPLE_STATUS);    op->_flags &= ~(ASYNC_OPFLAGS_CALLBACK | ASYNC_OPFLAGS_SIMPLE_STATUS);
    op->_state &= ~ASYNC_OPSTATE_COMPLETE;    op->_state &= ~ASYNC_OPSTATE_COMPLETE;
      op->unlock();
    // get the queue handle for the destination     if ( op->_op_dest == 0 )
    if ( 0 == (op->_op_dest = MessageQueue::lookup(msg->dest)))  
    {  
       return false;       return false;
    }  
  
    // now see if the meta dispatcher will take it    // now see if the meta dispatcher will take it
    Boolean return_code = _meta_dispatcher->route_async(op);     return  _meta_dispatcher->route_async(op);
    return  return_code;  
   
   
 } }
  
  
Line 634 
Line 649 
    }    }
  
    request->block = true;    request->block = true;
      request->op->lock();
    request->op->_state &= ~ASYNC_OPSTATE_COMPLETE;    request->op->_state &= ~ASYNC_OPSTATE_COMPLETE;
    request->op->_flags &= ~ASYNC_OPFLAGS_CALLBACK;    request->op->_flags &= ~ASYNC_OPFLAGS_CALLBACK;
  
    // get the queue handle for the destination     request->op->_op_dest = MessageQueue::lookup(request->dest);
    if ( 0 == (request->op->_op_dest = MessageQueue::lookup(request->dest)))     request->op->unlock();
       return 0;  
  
      if ( request->op->_op_dest == 0 )
         return 0;
  
    // now see if the meta dispatcher will take it    // now see if the meta dispatcher will take it
   
    if (true == _meta_dispatcher->route_async(request->op))    if (true == _meta_dispatcher->route_async(request->op))
    {    {
       request->op->_client_sem.wait();       request->op->_client_sem.wait();
       PEGASUS_ASSERT(request->op->_state & ASYNC_OPSTATE_COMPLETE);       PEGASUS_ASSERT(request->op->_state & ASYNC_OPSTATE_COMPLETE);
   
    }    }
  
    request->op->lock();    request->op->lock();
Line 662 
Line 677 
       request->op->_request.remove(request);       request->op->_request.remove(request);
       request->op->_state |= ASYNC_OPSTATE_RELEASED;       request->op->_state |= ASYNC_OPSTATE_RELEASED;
       request->op->unlock();       request->op->unlock();
   
       return_op(request->op);       return_op(request->op);
       request->op = 0;       request->op = 0;
    }    }


Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2