Tuesday, May 5, 2015

When Processing large data , my computer becomes idle and c# console application also gets halted.

First thing I would try is calling SetThreadExecutionState.  (Obviously you'll have to get at it through P/Invoke

Specifically, to prevent sleeping:

SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED);

Then, when your processing completes and it's ok to let the system idle again, do this:

SetThreadExecutionState(ES_CONTINUOUS);

No comments:

Post a Comment