Skip to content

Instantly share code, notes, and snippets.

@gvx
Created September 19, 2012 23:01
Show Gist options
  • Save gvx/3752907 to your computer and use it in GitHub Desktop.
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.
#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