diff --git a/libkineto/src/init.cpp b/libkineto/src/init.cpp index c0259d6..e960a92 100644 --- a/libkineto/src/init.cpp +++ b/libkineto/src/init.cpp @@ -34,8 +34,12 @@ static bool initialized = false; static void initProfilers() { if (!initialized) { + // Caution: `initProfilerIfRegistered` spawns the `updateConfigThread`, so + // either: + // 1. Ensure nothing the main thread does not do anything which could race + // with the `updateConfigThread` (current invariant) + // 2. Guard the raceable data appropriately libkineto::api().initProfilerIfRegistered(); - libkineto::api().configLoader().initBaseConfig(); initialized = true; VLOG(0) << "libkineto profilers activated"; }