------------------------------------------------------------------------------
| 536 | |
| 537 | //------------------------------------------------------------------------------ |
| 538 | void vtkMultiProcessController::TriggerRMIInternal( |
| 539 | int remoteProcessId, void* arg, int argLength, int rmiTag, bool propagate) |
| 540 | { |
| 541 | int triggerMessage[128]; |
| 542 | triggerMessage[0] = rmiTag; |
| 543 | triggerMessage[1] = argLength; |
| 544 | |
| 545 | // It is important for the remote process to know what process invoked it. |
| 546 | // Multiple processes might try to invoke the method at the same time. |
| 547 | // The remote method will know where to get additional args. |
| 548 | triggerMessage[2] = this->GetLocalProcessId(); |
| 549 | |
| 550 | // Pass the propagate flag. |
| 551 | triggerMessage[3] = propagate ? 1 : 0; |
| 552 | |
| 553 | // We send the header in Little Endian order. |
| 554 | vtkByteSwap::SwapLERange(triggerMessage, 4); |
| 555 | |
| 556 | // If the message is small, we will try to get the message sent over using a |
| 557 | // single Send(), rather than two. This helps speed up communication |
| 558 | // significantly, since sending multiple small messages is generally slower |
| 559 | // than sending a single large message. |
| 560 | if (argLength >= 0 && static_cast<unsigned int>(argLength) < sizeof(int) * (128 - 4)) |
| 561 | { |
| 562 | if (argLength > 0) |
| 563 | { |
| 564 | memcpy(&triggerMessage[4], arg, argLength); |
| 565 | } |
| 566 | int num_bytes = static_cast<int>(4 * sizeof(int)) + argLength; |
| 567 | this->RMICommunicator->Send( |
| 568 | reinterpret_cast<unsigned char*>(triggerMessage), num_bytes, remoteProcessId, RMI_TAG); |
| 569 | } |
| 570 | else |
| 571 | { |
| 572 | this->RMICommunicator->Send(reinterpret_cast<unsigned char*>(triggerMessage), |
| 573 | static_cast<int>(4 * sizeof(int)), remoteProcessId, RMI_TAG); |
| 574 | if (argLength > 0) |
| 575 | { |
| 576 | this->RMICommunicator->Send((char*)arg, argLength, remoteProcessId, RMI_ARG_TAG); |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | //------------------------------------------------------------------------------ |
| 582 | void vtkMultiProcessController::TriggerBreakRMIs() |
no test coverage detected