m2.mbcp/src/lowsender.cc

27 lines
584 B
C++
Raw Normal View History

2006-02-05 17:43:00 +00:00
#include "lowsender.h"
#define MESSAGE "AB or CB cast from LowSender ? hehe...."
LowSender::LowSender(Group &grp, Clock &clk, Protocol::Type type) : _group(grp), _clock(clk), _type(type) {
}
void LowSender::run(){
// thread part
while(1){
sleep(3);
printf("LowSender -- Broadcasting '%s'\n", MESSAGE);
TimeStamp ts = _clock.inc();
printf("LowSender::run -- Timestamp done\n");
Message msg(_type, ts, MESSAGE, strlen(MESSAGE));
printf("LowSender::run -- Mesg done and ready to send\n");
_group.broadcast(msg);
printf("LowSender::run -- Mesg sent\n");
}
}