LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members
llvm::sys::MutexImpl Class Reference

Platform agnostic Mutex class. More...

#include <Mutex.h>

Inheritance diagram for llvm::sys::MutexImpl:
Inheritance graph
[legend]

Public Member Functions

Constructors
 MutexImpl (bool recursive=true)
 Default Constructor. More...
 
 ~MutexImpl ()
 Destructor. More...
 
Methods
bool acquire ()
 Unconditionally acquire the lock. More...
 
bool release ()
 Unconditionally release the lock. More...
 
bool tryacquire ()
 Try to acquire the lock. More...
 

Detailed Description

Platform agnostic Mutex class.

Definition at line 26 of file Mutex.h.

Constructor & Destructor Documentation

llvm::MutexImpl::MutexImpl ( bool  recursive = true)
explicit

Default Constructor.

Initializes the lock but doesn't acquire it. if recursive is set to false, the lock will not be recursive which makes it cheaper but also more likely to deadlock (same thread can't acquire more than once).

Definition at line 44 of file Mutex.cpp.

References llvm::LibFunc::malloc.

llvm::MutexImpl::~MutexImpl ( )

Destructor.

Releases and removes the lock

Definition at line 82 of file Mutex.cpp.

References llvm::LibFunc::free.

Member Function Documentation

bool llvm::MutexImpl::acquire ( )

Unconditionally acquire the lock.

Attempts to unconditionally acquire the lock. If the lock is held by another thread, this method will wait until it can acquire the lock.

Returns
false if any kind of error occurs, true otherwise.

Definition at line 91 of file Mutex.cpp.

Referenced by llvm::sys::SmartMutex< false >::acquire().

bool llvm::MutexImpl::release ( )

Unconditionally release the lock.

Attempts to release the lock. If the lock is held by the current thread, the lock is released allowing other threads to acquire the lock.

Returns
false if any kind of error occurs, true otherwise.

Definition at line 101 of file Mutex.cpp.

Referenced by llvm::sys::SmartMutex< false >::release().

bool llvm::MutexImpl::tryacquire ( )

Try to acquire the lock.

Attempts to acquire the lock without blocking. If the lock is not available, this function returns false quickly (without blocking). If the lock is available, it is acquired.

Returns
false if any kind of error occurs or the lock is not available, true otherwise.

Definition at line 111 of file Mutex.cpp.

Referenced by llvm::sys::SmartMutex< false >::tryacquire().


The documentation for this class was generated from the following files: