The target framework of my application is .NET 6.0
, and it will run on Windows, macOS, and Linux. I would like my application to prevent its host from entering sleep/idle mode while the application is performing certain tasks. I can achieve this on Windows by following steps such as this.
However, I am not sure how portable these steps are. MSDN page on SetThreadExecutionState
reads:
Target Platform Windows
Does it mean the above-linked approach is not portable? if not, is there any universal approach for preventing the host system from entering the sleep/idle state?