10 #ifndef __PION_PROCESS_HEADER__
11 #define __PION_PROCESS_HEADER__
14 #include <boost/noncopyable.hpp>
15 #include <boost/thread/once.hpp>
16 #include <boost/thread/mutex.hpp>
17 #include <boost/thread/condition.hpp>
18 #include <pion/config.hpp>
26 typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
27 CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
28 CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
29 CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
38 private boost::noncopyable
49 static void shutdown(
void);
52 static void wait_for_shutdown(
void);
55 static void initialize(
void);
58 static void daemonize(
void);
62 class dumpfile_init_exception :
public std::exception
65 dumpfile_init_exception(
const std::string& cause) : m_cause(cause) {}
67 virtual const char* what()
const {
return m_cause.c_str(); }
77 static void set_dumpfile_directory(
const std::string& dir);
81 static LONG WINAPI unhandled_exception_filter(
struct _EXCEPTION_POINTERS *pExceptionInfo);
84 static std::string generate_dumpfile_name();
93 config_type() : shutdown_now(
false), h_dbghelp(NULL), p_dump_proc(NULL) {}
109 std::string dumpfile_dir;
116 MINIDUMPWRITEDUMP p_dump_proc;
122 boost::call_once(process::create_config, m_instance_flag);
123 return *m_config_ptr;
130 static void create_config(
void);
134 static boost::once_flag m_instance_flag;
137 static config_type * m_config_ptr;
bool shutdown_now
true if we should shutdown now
config_type()
constructor just initializes native types
data type for static/global process configuration information
process(void)
default constructor
boost::mutex shutdown_mutex
used to protect the shutdown condition
boost::condition shutdown_cond
triggered when it is time to shutdown
static config_type & get_config(void)
returns a singleton instance of config_type