Coffeehouse Post

Single Post Permalink

View Thread: Instructions...
  • User profile image

    Rossj wrote:
    asqui wrote:

    Plug in the sandwich maker and observe the green light once it has reached a steady-state. Wait until the state of the green light changes (approx. 4-5 minutes). The machine has now reached the correct temperature.


    assert(sandwichMaker.redLight.state == true);
    bool greenLightState = sandwichMaker.greenLight.state;
    while (sandwichMaker.greenLight.state == greenLightState) {};

    // the machine has now reached the correct temperature.

    Reminds me of the joke :  How do you keep a programmer busy in the bath? Give him some shampoo - lather, rinse, repeat.  At least I thought it was funny.

    I tried to put some sort of timeout around the while loop but I couldn't work out how to do it -- I'm not very proficient with C# and the .NET Framework.