[ARM] MVE integer min and max
[llvm-complete.git] / lib / Support / Windows / Mutex.inc
blobb55b14febf2cd23a4aa4448255c28069ae5ce530
1 //===- llvm/Support/Win32/Mutex.inc - Win32 Mutex Implementation -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the Win32 specific (non-pthread) Mutex class.
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
14 //=== WARNING: Implementation here must contain only generic Win32 code that
15 //===          is guaranteed to work on *all* Win32 variants.
16 //===----------------------------------------------------------------------===//
18 #include "WindowsSupport.h"
19 #include "llvm/Support/Mutex.h"
21 namespace llvm {
23 sys::MutexImpl::MutexImpl(bool /*recursive*/)
25   data_ = new CRITICAL_SECTION;
26   InitializeCriticalSection((LPCRITICAL_SECTION)data_);
29 sys::MutexImpl::~MutexImpl()
31   DeleteCriticalSection((LPCRITICAL_SECTION)data_);
32   delete (LPCRITICAL_SECTION)data_;
33   data_ = 0;
36 bool
37 sys::MutexImpl::acquire()
39   EnterCriticalSection((LPCRITICAL_SECTION)data_);
40   return true;
43 bool
44 sys::MutexImpl::release()
46   LeaveCriticalSection((LPCRITICAL_SECTION)data_);
47   return true;
50 bool
51 sys::MutexImpl::tryacquire()
53   return TryEnterCriticalSection((LPCRITICAL_SECTION)data_);