Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: src/IceInstrumentation.cpp

Issue 2165493002: Subzero: Fixed deadlock with _start but no globals (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Added condition variable and moved synchronization to Instrumentation Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceInstrumentation.cpp
diff --git a/src/IceInstrumentation.cpp b/src/IceInstrumentation.cpp
index 0cd218abcbdbd7df2507cab8808dbcfdb7db5c20..b816a15d0a38ea5d62f99fe6552382a696f1f5ed 100644
--- a/src/IceInstrumentation.cpp
+++ b/src/IceInstrumentation.cpp
@@ -118,4 +118,17 @@ void Instrumentation::instrumentInst(LoweringContext &Context) {
}
}
+void Instrumentation::setHasSeenGlobals() {
+ std::unique_lock<std::mutex> GlobalsLock(GlobalsSeenMutex);
Jim Stichnoth 2016/07/19 22:39:00 I think this could be simpler: void Instrumentati
tlively 2016/07/19 23:20:14 Done.
+ HasSeenGlobals = true;
+ GlobalsLock.unlock();
+ GlobalsSeenCV.notify_all();
+}
+
+LockedPtr<VariableDeclarationList> Instrumentation::getGlobals() {
+ std::unique_lock<std::mutex> GlobalsLock(GlobalsSeenMutex);
+ GlobalsSeenCV.wait(GlobalsLock, [&] { return HasSeenGlobals; });
Jim Stichnoth 2016/07/19 22:39:00 Instead of default capture, can you capture "this"
tlively 2016/07/19 23:20:14 Done.
+ return Ctx->getGlobals();
+}
+
} // end of namespace Ice

Powered by Google App Engine
This is Rietveld 408576698