LLVM API Documentation

Signals.h

Go to the documentation of this file.
00001 //===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by the LLVM research group and is distributed under
00006 // the University of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines some helpful functions for dealing with the possibility of
00011 // unix signals occuring while your program is running.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_SYSTEM_SIGNALS_H
00016 #define LLVM_SYSTEM_SIGNALS_H
00017 
00018 #include "llvm/System/Path.h"
00019 
00020 namespace llvm {
00021 namespace sys {
00022 
00023   /// This function registers signal handlers to ensure that if a signal gets
00024   /// delivered that the named file is removed.
00025   /// @brief Remove a file if a fatal signal occurs.
00026   void RemoveFileOnSignal(const Path &Filename);
00027 
00028   /// This function registers a signal handler to ensure that if a fatal signal
00029   /// gets delivered to the process that the named directory and all its
00030   /// contents are removed.
00031   /// @brief Remove a directory if a fatal signal occurs.
00032   void RemoveDirectoryOnSignal(const Path& path);
00033 
00034   /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
00035   /// process, print a stack trace and then exit.
00036   /// @brief Print a stack trace if a fatal signal occurs.
00037   void PrintStackTraceOnErrorSignal();
00038 
00039   /// This function registers a function to be called when the user "interrupts"
00040   /// the program (typically by pressing ctrl-c).  When the user interrupts the
00041   /// program, the specified interrupt function is called instead of the program
00042   /// being killed, and the interrupt function automatically disabled.  Note
00043   /// that interrupt functions are not allowed to call any non-reentrant
00044   /// functions.  An null interrupt function pointer disables the current
00045   /// installed function.  Note also that the handler may be executed on a
00046   /// different thread on some platforms.
00047   /// @brief Register a function to be called when ctrl-c is pressed.
00048   void SetInterruptFunction(void (*IF)());
00049 } // End sys namespace
00050 } // End llvm namespace
00051 
00052 #endif