[ARM] More MVE compare vector splat combines for ANDs
[llvm-complete.git] / lib / Support / Unix / RWMutex.inc
blob8b47dfa0f85cd5714741df4affe8f26be700c067
1 //= llvm/Support/Unix/RWMutex.inc - Unix Reader/Writer Mutual Exclusion Lock  =//
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 Unix specific (non-pthread) RWMutex class.
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
14 //=== WARNING: Implementation here must contain only generic UNIX code that
15 //===          is guaranteed to work on *all* UNIX variants.
16 //===----------------------------------------------------------------------===//
18 #include "llvm/Support/Mutex.h"
20 namespace llvm {
22 using namespace sys;
24 // This naive implementation treats readers the same as writers.  This
25 // will therefore deadlock if a thread tries to acquire a read lock
26 // multiple times.
28 RWMutexImpl::RWMutexImpl() : data_(new MutexImpl(false)) { }
30 RWMutexImpl::~RWMutexImpl() {
31   delete static_cast<MutexImpl *>(data_);
34 bool RWMutexImpl::reader_acquire() {
35   return static_cast<MutexImpl *>(data_)->acquire();
38 bool RWMutexImpl::reader_release() {
39   return static_cast<MutexImpl *>(data_)->release();
42 bool RWMutexImpl::writer_acquire() {
43   return static_cast<MutexImpl *>(data_)->acquire();
46 bool RWMutexImpl::writer_release() {
47   return static_cast<MutexImpl *>(data_)->release();