lock_impl_win.cc 637 B

123456789101112131415161718192021222324
  1. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/synchronization/lock_impl.h"
  5. #include "base/debug/activity_tracker.h"
  6. #include <windows.h>
  7. namespace base {
  8. namespace internal {
  9. LockImpl::LockImpl() : native_handle_(SRWLOCK_INIT) {}
  10. LockImpl::~LockImpl() = default;
  11. void LockImpl::LockInternalWithTracking() {
  12. base::debug::ScopedLockAcquireActivity lock_activity(this);
  13. ::AcquireSRWLockExclusive(reinterpret_cast<PSRWLOCK>(&native_handle_));
  14. }
  15. } // namespace internal
  16. } // namespace base