when programming embedded systems infinite loops are used all the time. e.g. when switched on a river level monitoring system goes into an infinite loop checking the water level and reporting regularly.
The following is a fragment of code from a USB device (which can be connected to a PC USB port) based on a Microchip PIC24FJ64GB002 microcontroller
-
InitializeSystem(); // initialise USB and IO devices
-
while(1)
-
{
-
USBDeviceTasks(); // poll USB interface for activity
-
ProcessIO(); // process any device specific IO
-
}
-
in addition one also tends to have a watchdog timer which if the device gets into lockup state will restart the system.