Fix data race in folly/executors/Codel.cpp exposed by TSAN
[folly.git] / folly / File.cpp
index 4df3274eb86c3f77fa3280abb49303bbee9da9f0..74d8669ef1fc29852e935764609fb56877b9ff4e 100644 (file)
 
 namespace folly {
 
-File::File()
-  : fd_(-1)
-  , ownsFd_(false)
-{}
-
-File::File(int fd, bool ownsFd)
-  : fd_(fd)
-  , ownsFd_(ownsFd) {
+File::File() noexcept : fd_(-1), ownsFd_(false) {}
+
+File::File(int fd, bool ownsFd) noexcept : fd_(fd), ownsFd_(ownsFd) {
   CHECK_GE(fd, -1) << "fd must be -1 or non-negative";
   CHECK(fd != -1 || !ownsFd) << "cannot own -1";
 }
@@ -153,4 +148,4 @@ void File::unlock() {
 }
 void File::unlock_shared() { unlock(); }
 
-}  // namespace folly
+} // namespace folly