Reset vtid after fork in child
[lttng-ust.git] / libust / lttng-context-vtid.c
index fd1e320078a1e949aab91df298dc326a21aa27fc..a7e1c81de80174d998c52bfd301c0418eec17aff 100644 (file)
@@ -38,6 +38,16 @@ static inline pid_t gettid(void)
  */
 static __thread pid_t cached_vtid;
 
+/*
+ * Upon fork or clone, the TID assigned to our thread is not the same as
+ * we kept in cache. Luckily, we are the only thread surviving in the
+ * child process, so we can simply clear our cached version.
+ */
+void lttng_context_vtid_reset(void)
+{
+       cached_vtid = 0;
+}
+
 static
 size_t vtid_get_size(size_t offset)
 {
This page took 0.02322 seconds and 4 git commands to generate.