-
Notifications
You must be signed in to change notification settings - Fork 23
Helpful Tools and Tips
Isaac Wilcove edited this page Jul 14, 2017
·
3 revisions
To exit out of a forever loop using ctrl+c
// Imports required
import sys
import signal
// Exit function
def ctrlc_exit(signal, frame):
sys.exit(0)
// Run the listener
signal.signal(signal.SIGINT, ctrlc_exit)
// Forever loop goes here
To exit out of a forever loop using ctrl+c
// Includes required
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
// Exit function
void ctrlc_exit(int signal){
printf("Exiting from signal: %d", signal);
exit(0);
}
// Main function
int main(int argc,char** argv)
{
// Create handler
struct sigaction handler;
// Handler properties
handler.sa_handler = ctrlc_exit;
sigemptyset(&handler.sa_mask);
handler.sa_flags = 0;
// Run the listener
sigaction(SIGINT, &handler, NULL);
// Forever loop goes here
}
Formula1Epoch
The self-driving car trained with deep learning