tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

lock_impl_win.cc (721B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      4 // Use of this source code is governed by a BSD-style license that can be
      5 // found in the LICENSE file.
      6 
      7 #include "base/lock_impl.h"
      8 
      9 namespace base {
     10 namespace internal {
     11 
     12 LockImpl::LockImpl() : native_handle_(SRWLOCK_INIT) {}
     13 
     14 LockImpl::~LockImpl() = default;
     15 
     16 bool LockImpl::Try() { return !!::TryAcquireSRWLockExclusive(&native_handle_); }
     17 
     18 void LockImpl::Lock() { ::AcquireSRWLockExclusive(&native_handle_); }
     19 
     20 void LockImpl::Unlock() { ::ReleaseSRWLockExclusive(&native_handle_); }
     21 
     22 }  // namespace internal
     23 }  // namespace base