Пример #1
0
/// Method invoked upon receipt a message routed through comlib.
void *strategyHandler(void *msg) {
    CmiMsgHeaderExt *conv_header = (CmiMsgHeaderExt *) msg;
    int instid = conv_header->stratid;

#ifndef CMK_OPTIMIZE
    // check that the instid is not zero, meaning a possibly uninitialized value
    if (instid == 0) {
      CmiAbort("Comlib strategy ID is zero, did you forget to initialize a variable?\n");
    }
#endif
    
    // when handling a message always call the lowest level
    Strategy *strat = ConvComlibGetStrategy(instid);
    
    strat->handleMessage(msg);
    return NULL;
}