1 //===- llvm/System/Mutex.h - Mutex Operating System Concept -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the llvm::sys::Mutex class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_SYSTEM_MUTEX_H
15 #define LLVM_SYSTEM_MUTEX_H
21 /// @brief Platform agnostic Mutex class.
24 /// @name Constructors
28 /// Initializes the lock but doesn't acquire it. if \p recursive is set
29 /// to false, the lock will not be recursive which makes it cheaper but
30 /// also more likely to deadlock (same thread can't acquire more than
32 /// @brief Default Constructor.
33 Mutex ( bool recursive = true );
35 /// Releases and removes the lock
44 /// Attempts to unconditionally acquire the lock. If the lock is held by
45 /// another thread, this method will wait until it can acquire the lock.
46 /// @returns false if any kind of error occurs, true otherwise.
47 /// @brief Unconditionally acquire the lock.
50 /// Attempts to release the lock. If the lock is held by the current
51 /// thread, the lock is released allowing other threads to acquire the
53 /// @returns false if any kind of error occurs, true otherwise.
54 /// @brief Unconditionally release the lock.
57 /// Attempts to acquire the lock without blocking. If the lock is not
58 /// available, this function returns false quickly (without blocking). If
59 /// the lock is available, it is acquired.
60 /// @returns false if any kind of error occurs or the lock is not
61 /// available, true otherwise.
62 /// @brief Try to acquire the lock.
66 /// @name Platform Dependent Data
70 void* data_; ///< We don't know what the data will be
74 /// @name Do Not Implement
77 Mutex(const Mutex & original);
78 void operator=(const Mutex &);