static OS_THREAD_SPECIFIC_PTR(void)
thread_num;
- unsigned LocalWriter::beginEnter(const FunctionSig *sig) {
+void LocalWriter::checkProcessId(void) {
+ if (m_file->isOpened() &&
+ os::getCurrentProcessId() != pid) {
+ // We are a forked child process that inherited the trace file, so
+ // create a new file. We can't call any method of the current
+ // file, as it may cause it to flush and corrupt the parent's
+ // trace, so we effectively leak the old file object.
+ m_file = File::createSnappy();
+ // Don't want to open the same file again
+ os::unsetEnvironment("TRACE_FILE");
+ open();
+ }
+}
+
+ unsigned LocalWriter::beginEnter(const FunctionSig *sig, bool fake) {
mutex.lock();
++acquired;