Basic file locking.
If someone's already doing dex2oat, wait for them to finish rather
than duplicate their work.
Change-Id: Id620c75e013cbbcc84f5bf62a7629533a95307df
diff --git a/src/oatopt.cc b/src/oatopt.cc
index c792b4d..dd702d4 100644
--- a/src/oatopt.cc
+++ b/src/oatopt.cc
@@ -49,8 +49,12 @@
std::string oat_file_option("--oat=");
oat_file_option += GetArtCacheFilenameOrDie(OatFile::DexFilenameToOatFilename(dex_file.get()->GetLocation()));
- execl("/system/bin/dex2oatd",
- "/system/bin/dex2oatd",
+ std::string dex2oat("/system/bin/dex2oat");
+#ifndef NDEBUG
+ dex2oat += 'd';
+#endif
+
+ execl(dex2oat.c_str(), dex2oat.c_str(),
"--runtime-arg", "-Xms64m",
"--runtime-arg", "-Xmx64m",
"--boot-image=/data/art-cache/boot.art",