Created
September 19, 2012 23:01
-
-
Save gvx/3752907 to your computer and use it in GitHub Desktop.
A small program that goes to sleep right away and when you wake it, goes right back to sleep.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <signal.h> | |
void stop_self() | |
{ | |
raise(SIGSTOP); | |
} | |
int main() | |
{ | |
struct sigaction act; | |
act.sa_handler = stop_self; | |
sigaction(SIGCONT, &act, 0); | |
stop_self(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment