diff options
author | José Fonseca <jose.r.fonseca@gmail.com> | 2011-09-22 17:49:24 +0100 |
---|---|---|
committer | José Fonseca <jose.r.fonseca@gmail.com> | 2011-09-22 17:49:24 +0100 |
commit | 9acebf9ca871b3f9a5dfba0ac4f3a9c562c12ff0 (patch) | |
tree | 0ad12af43fa993be4676e5059fd371d98a72ea36 /common/trace_local_writer.cpp | |
parent | 4106eb4ff92852a4eed5ac66d9cbedb14a7bfb8d (diff) |
Install the signal handlers as early as possible,
To prevent interfering with the application's signal handling.
Diffstat (limited to 'common/trace_local_writer.cpp')
-rw-r--r-- | common/trace_local_writer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/trace_local_writer.cpp b/common/trace_local_writer.cpp index ea6c111..e625f2e 100644 --- a/common/trace_local_writer.cpp +++ b/common/trace_local_writer.cpp @@ -41,14 +41,17 @@ namespace Trace { static void exceptionCallback(void) { - OS::DebugMessage("apitrace: flushing trace due to an exception\n"); localWriter.flush(); } LocalWriter::LocalWriter() : acquired(0) -{} +{ + // Install the signal handlers as early as possible, to prevent + // interfering with the application's signal handling. + OS::SetExceptionCallback(exceptionCallback); +} LocalWriter::~LocalWriter() { @@ -96,8 +99,6 @@ LocalWriter::open(void) { Writer::open(szFileName); - OS::SetExceptionCallback(exceptionCallback); - #if 0 // For debugging the exception handler *((int *)0) = 0; @@ -142,6 +143,7 @@ void LocalWriter::flush(void) { if (!acquired) { OS::AcquireMutex(); if (m_file->isOpened()) { + OS::DebugMessage("apitrace: flushing trace due to an exception\n"); m_file->flush(); } OS::ReleaseMutex(); |