Changes:
- $Id: signal.c 4357 2006-01-22 23:33:38Z twisti $
+ $Id: signal.c 5038 2006-06-19 22:22:34Z twisti $
*/
#include "vm/types.h"
-#include "cacao/cacao.h"
-
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
# include "threads/native/threads.h"
#endif
#include "vm/signallocal.h"
#include "vm/options.h"
+#include "vm/vm.h"
#include "vm/jit/stacktrace.h"
sigaction(SIGINT, &act, NULL);
-
/* catch SIGQUIT for thread dump */
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
#if !defined(__FREEBSD__)
act.sa_sigaction = signal_handler_sigquit;
act.sa_flags = SA_SIGINFO;
sigaction(SIGUSR1, &act, NULL);
#endif
#endif
+
+#if defined(ENABLE_THREADS) && defined(ENABLE_PROFILING)
+ /* install signal handler for profiling sampling */
+
+ act.sa_sigaction = md_signal_handler_sigusr2;
+ act.sa_flags = SA_SIGINFO;
+ sigaction(SIGUSR2, &act, NULL);
+#endif
}
*******************************************************************************/
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
void signal_handler_sigquit(int sig, siginfo_t *siginfo, void *_p)
{
/* do thread dump */
{
/* if we are already in Runtime.exit(), just do it hardcore */
- if (cacao_exiting) {
- fprintf(stderr, "Catched SIGINT while already shutting down. Shutdown aborted...\n");
+ if (vm_exiting) {
+ fprintf(stderr, "Caught SIGINT while already shutting down. Shutdown aborted...\n");
exit(0);
}
/* exit the vm properly */
- cacao_exit(0);
+ vm_exit(0);
}
*******************************************************************************/
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
void signal_handler_sigusr1(int sig, siginfo_t *siginfo, void *_p)
{
/* call stacktrace function */