24 getCaster().remove(name,
this);
26 if (elect ==
nullptr) {
37 if (elect !=
nullptr) {
41 comm =
new MpiComm(name+
"->bcast");
47 getCaster().add(name,
this);
48 electionMember =
true;
58 yCDebug(
MPI_CARRIER,
"[MpiBcastCarrier @ %s] Disconnect : %s", name.c_str(), other.c_str());
60 MPI_Bcast(&cmd, 1, MPI_INT, 0,comm->comm);
61 int length = other.length() + name.length() + 3;
62 char* remote_c =
new char[length];
63 strcpy(remote_c, (other+
"<-"+name).c_str());
64 MPI_Bcast(&length, 1, MPI_INT, 0,comm->comm);
65 MPI_Bcast(remote_c, length, MPI_CHAR, 0,comm->comm);
67 comm->disconnect(
false);
83 if (caster==
nullptr) {
86 if (caster==
nullptr) {
97 return elect==
this || elect==
nullptr;
const yarp::os::LogComponent & MPI_CARRIER()
Carrier for port communicating via MPI broadcast.
virtual ~MpiBcastCarrier()
void close() override
Close the carrier.
void createStream(bool sender) override
virtual bool isElect() const
void prepareDisconnect() override
Do cleanup and preparation for the coming disconnect, if necessary.
bool isActive() const override
Check if carrier is alive and error free.
Implements communication via MPI broadcast.
Wrapper for MPI_Comm communicator.
Pick one of a set of peers to be "active".
static void unlock()
Call post() on a global mutual-exclusion semaphore allocated by YARP.
static void lock()
Call wait() on a global mutual-exclusion semaphore allocated by YARP.
#define yCError(component,...)
#define yCTrace(component,...)
#define yCDebug(component,...)
An interface to the operating system, including Port based communication.