#include #include "macros.h" #include "lowsender.h" #define DEBUG 0 #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 srand(time(NULL)); for (int delay = 10; delay >= 0; delay-- ){ printf("\rLowSender::run -- Waiting %d seconds... ", delay); fflush(stdout); sleep(1); } printf("\n"); while(1){ sleep(1); printf("LowSender::run -- Broadcasting '%s'\n", MESSAGE); TimeStamp ts = _clock.inc(); pDEBUG("Timestamp done\n"); Message msg(_type, ts, MESSAGE, strlen(MESSAGE)); pDEBUG("Mesg done and ready to send\n"); _group.broadcast(msg); pDEBUG("Mesg sent\n"); } }