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/common_test.h b/src/common_test.h
index 928cb51..3966742 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -56,6 +56,7 @@
filename_ += "/TmpFile-XXXXXX";
fd_ = mkstemp(&filename_[0]);
CHECK_NE(-1, fd_);
+ file_.reset(OS::FileFromFd(GetFilename(), fd_));
}
~ScratchFile() {
@@ -69,6 +70,10 @@
return filename_.c_str();
}
+ File* GetFile() const {
+ return file_.get();
+ }
+
int GetFd() const {
return fd_;
}
@@ -76,6 +81,7 @@
private:
std::string filename_;
int fd_;
+ UniquePtr<File> file_;
};
class CommonTest : public testing::Test {