Mercurial > hg > graal-compiler
comparison src/os/posix/vm/os_posix.hpp @ 11151:5e3b6f79d280
8020701: Avoid crashes in WatcherThread
Reviewed-by: acorn, dcubed, dsimms
author | rbackman |
---|---|
date | Wed, 17 Jul 2013 13:48:15 +0200 |
parents | b9a9ed0f8eeb |
children | de6a9e811145 f42f2e2a1518 |
comparison
equal
deleted
inserted
replaced
11150:c29568b733d2 | 11151:5e3b6f79d280 |
---|---|
35 static void print_load_average(outputStream* st); | 35 static void print_load_average(outputStream* st); |
36 | 36 |
37 | 37 |
38 }; | 38 }; |
39 | 39 |
40 /* | |
41 * Crash protection for the watcher thread. Wrap the callback | |
42 * with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp | |
43 * back. | |
44 * To be able to use this - don't take locks, don't rely on destructors, | |
45 * don't make OS library calls, don't allocate memory, don't print, | |
46 * don't call code that could leave the heap / memory in an inconsistent state, | |
47 * or anything else where we are not in control if we suddenly jump out. | |
48 */ | |
49 class WatcherThreadCrashProtection : public StackObj { | |
50 public: | |
51 WatcherThreadCrashProtection(); | |
52 bool call(os::CrashProtectionCallback& cb); | |
53 | |
54 static void check_crash_protection(int signal, Thread* thread); | |
55 private: | |
56 void restore(); | |
57 sigjmp_buf _jmpbuf; | |
58 }; | |
40 | 59 |
41 #endif | 60 #endif |