If the screensaver is activated (because halting for some time) and you want to kill it (activate the machine), you may use the following C code:
To temporally disable screensaver (maybe your application is working on something and you do not want the screen to turn off automatically), you may use:
However, your system may go wrong using the above code. Imagine if your application crashed after disabling the screensaver, then it will keep disabled until you re-enable it manually. In this case, you can just set the state of your current thread to tell the system that this thread requires attention.