made forking not generate incorrect information
diff --git a/aos/common/logging/logging_impl.cc b/aos/common/logging/logging_impl.cc
index 66e64d8..7b49f7b 100644
--- a/aos/common/logging/logging_impl.cc
+++ b/aos/common/logging/logging_impl.cc
@@ -66,8 +66,21 @@
}
}
+void NewContext() {
+ Context::Delete();
+}
+
void *DoInit() {
SetGlobalImplementation(new RootLogImplementation());
+
+#ifndef __VXWORKS__
+ if (pthread_atfork(NULL /*prepare*/, NULL /*parent*/,
+ NewContext /*child*/) != 0) {
+ LOG(FATAL, "pthread_atfork(NULL, NULL, %p) failed\n",
+ NewContext);
+ }
+#endif
+
return NULL;
}