serial2mqtt
serial2mqtt copied to clipboard
the sleep(UINT32_MAX) has exited on OpenWRT instantly
The sleep(UINT32_MAX) has exited instantly on OpenWrt. This fix will work forever :-)
I forgot to mention, that sleep(INT32_MAX) is working correctly, only the greater values are problematic. It's definetly not a busy loop. The for loop around the sleep is just some extra pedantry:
- serial2mqtt could run longer than than 68 years :-)
- theoretically signal handlers could interrupt sleep (currently we don't use signal handlers, but this solution is future proof)
If you have any concerns, please let me know.
Or we can use a more idiomatic way:
for (;;)
{
pause();
}