dimanche 28 juin 2015

Sleeping/waiting for a long time

I am designing an industrial hardware control program in C#, which will run for periods of 72 hours at a time talking over serial ports.

In psuedo-code, what I am trying to do looks like this:-

while(true) {
    TalkToSerialPort1();
    WaitForXHours(3);
    TalkToSerialPort2();
    WaitForXHours(1);
    // etc
}

I have this code in a separate thread from my main console or GUI program and has to be run procedureally

It seems like Thread.Sleep() for long periods of time seems to be ruining my day! I am looking for a reliable way of sleeping for extended periods of time.

Any information would be helpful.

Aucun commentaire:

Enregistrer un commentaire