| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "rlz/mac/lib/rlz_value_store_mac.h" | 5 #include "rlz/mac/lib/rlz_value_store_mac.h" |
| 6 | 6 |
| 7 #include "base/eintr_wrapper.h" | 7 #include "base/eintr_wrapper.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 file_lock_ = -1; | 289 file_lock_ = -1; |
| 290 return false; | 290 return false; |
| 291 } | 291 } |
| 292 return true; | 292 return true; |
| 293 } else { | 293 } else { |
| 294 return file_lock_ != -1; | 294 return file_lock_ != -1; |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 void RecursiveCrossProcessLock::ReleaseLock() { | 298 void RecursiveCrossProcessLock::ReleaseLock() { |
| 299 if (file_lock_) { | 299 if (file_lock_ != -1) { |
| 300 ignore_result(HANDLE_EINTR(flock(file_lock_, LOCK_UN))); | 300 ignore_result(HANDLE_EINTR(flock(file_lock_, LOCK_UN))); |
| 301 ignore_result(HANDLE_EINTR(close(file_lock_))); | 301 ignore_result(HANDLE_EINTR(close(file_lock_))); |
| 302 file_lock_ = -1; | 302 file_lock_ = -1; |
| 303 } | 303 } |
| 304 | 304 |
| 305 locking_thread_ = 0; | 305 locking_thread_ = 0; |
| 306 pthread_mutex_unlock(&recursive_lock_); | 306 pthread_mutex_unlock(&recursive_lock_); |
| 307 } | 307 } |
| 308 | 308 |
| 309 | 309 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 } else { | 445 } else { |
| 446 // Not Unsafe on OS X. | 446 // Not Unsafe on OS X. |
| 447 g_test_folder = | 447 g_test_folder = |
| 448 [[NSString alloc] initWithUTF8String:directory.AsUTF8Unsafe().c_str()]; | 448 [[NSString alloc] initWithUTF8String:directory.AsUTF8Unsafe().c_str()]; |
| 449 } | 449 } |
| 450 } | 450 } |
| 451 | 451 |
| 452 } // namespace testing | 452 } // namespace testing |
| 453 | 453 |
| 454 } // namespace rlz_lib | 454 } // namespace rlz_lib |
| OLD | NEW |