示例#1
0
  //-----------------------------------------------------------------------
  int BspProxyImpl::bspSendWrapper(struct lua_State * state){

    int n = lua_gettop(state);
    assert(n == 1);

    BspSend bspSend;

    bspSend.tagSize(LuaUtils::getIntFromTable(state, "tagSize"))
          .nBytes(LuaUtils::getIntFromTable(state, "nBytes"))
          .superstep(LuaUtils::getIntFromTable(state, "superstep"));


    lua_pushstring(state, "payload");
    lua_gettable(state, -2);
    bspSend.writeInMem(lua_tostring(state,-1));
    lua_pop(state, 1);
    
    lua_pushstring(state, "tag");
    lua_gettable(state, -2);
    bspSend.writeTag(lua_tostring(state,-1));
    lua_pop(state, 1);


    BspProxyImpl::singleInstance->bsmpManager_->addSend(bspSend);
    return 0;
  }
示例#2
0
  //-----------------------------------------------------------------------
  void BsmpManager::bspSend(int pid,const void *tag, const void * payload,int payload_bytes){

    assert(0 <= pid < baseProcess_->getTotalNumProcs());

    BspSend bspSend;
    bspSend.nBytes(payload_bytes).superstep(baseProcess_->superstep()).tagSize(currentTagSize_.value());
    bspSend.writeInMem(payload);
    bspSend.writeTag(tag);
    //cerr << "BsmpManager::bspSend->sending message to task: " << pid << endl;
    //bspSend.dump(true);
    if (pid != baseProcess_->getMyPid())
      stubPool_->bspSend(pid, bspSend);
    else
     addSend(bspSend);

  }