jeudi 18 octobre 2018

How to use boost::asio::deadline_timer, ( timer.async_wait ())

I have buffer of 300MB. Index In & Out are equal when the buffer is empty. I need to fix two timers, say t1 to read 30MB data from the buffer after each 27.8ms and t2 is to send status report after each 3ms.

class buffer{
private:
int In,Out;
public:
buffer(){ In=0; Out=0}
void Read(int numBytes){
// after checking underflow condition
out+=numBytes;

void Write(int numBytes){
  //if (firstwrite==true){
 // (Do i need to fix the timers here){

 //  timer1.start(30ms,Read);
//  timer2.start(3ms,Status);

// after checking overflow condi
in+=numBytes
}
void Status(){
currentStatus = In-Out;
} 

Here i need the timers. One for reading and for sending status report after specific time like timer1.start(30ms,Read), timer2.start(3ms,Status). I do not know where and how to fix these timers

Aucun commentaire:

Enregistrer un commentaire