void sender() {
    int n = 0;
    while (n < 100) {
        buf.send(n);
        std::cout << "sent: " << n << std::endl;
        ++n;
    }
    buf.send(-1);
}
Exemple #2
0
void sender() {
    int n = 0;
    while (n < 100) {
        buf.send(n);
        {
            boost::mutex::scoped_lock io_lock(io_mutex);
            std::cout << "sent: " << n << std::endl;
        }
        ++n;
    }
    buf.send(-1);
}
Exemple #3
0
void receiver() {
    int n;
    do {
        n = buf.receive();
        if(!(n%10000))
        {
            boost::unique_lock<boost::mutex> io_lock(io_mutex);
            std::cout << "received: " << n << std::endl;
        }
    } while (n != -1); // -1 indicates end of buffer
    buf.send(-1);
}
Exemple #4
0
void sender() {
    int n = 0;
    while (n < 1000000) {
        buf.send(n);
        if(!(n%10000))
        {
            boost::unique_lock<boost::mutex> io_lock(io_mutex);
            std::cout << "sent: " << n << std::endl;
        }
        ++n;
    }
    buf.send(-1);
}
void receiver() {
    int n;
    do {
        n = buf.receive();
        std::cout << "received: " << n << std::endl;
    } while (n != -1); // -1 indicates end of buffer
}
Exemple #6
0
int main(int argc, char* argv[]) {
	boost::thread worker(workThread);
	srand((int)time(0));
	while(true){
		waitForNextTurn();
		msgqueue.push_front(boost::posix_time::microsec_clock::universal_time());
	}
	return 0;
}
Exemple #7
0
void receiver() {
    int n;
    do {
        n = buf.receive();
        {
            boost::mutex::scoped_lock io_lock(io_mutex);
            std::cout << "received: " << n << std::endl;
        }
    } while (n != -1); // -1 indicates end of buffer
}
Exemple #8
0
void workThread(void)
{
	for(;;){
		boost::posix_time::ptime t;
		msgqueue.pop_back(&t);
		boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970,1,1));
		boost::posix_time::time_duration diff=t-time_t_epoch;
		std::string server("localhost");
		std::string port("8081");
		std::string s = str(format("hallo %1%") % 10);
		std::string path = str(format("/erl/aclog:logdata?&time=%1%&turns=1") % static_cast<unsigned long long>(diff.total_milliseconds()));
		while(0 != httpgets(server,port,path)){
			boost::this_thread::sleep(boost::posix_time::seconds(2));
		}
	}
}