LLVM API Documentation

llvm::sys::SmartMutex< mt_only > Class Template Reference

#include <Mutex.h>

Inheritance diagram for llvm::sys::SmartMutex< mt_only >:
[legend]
Collaboration diagram for llvm::sys::SmartMutex< mt_only >:
[legend]

List of all members.

Public Member Functions

 SmartMutex (bool rec=true)
bool acquire ()
 Unconditionally acquire the lock.
bool release ()
 Unconditionally release the lock.
bool tryacquire ()
 Try to acquire the lock.


Detailed Description

template<bool mt_only>
class llvm::sys::SmartMutex< mt_only >

SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should become a no-op when we're not running in multithreaded mode.

Definition at line 88 of file Mutex.h.


Constructor & Destructor Documentation

template<bool mt_only>
llvm::sys::SmartMutex< mt_only >::SmartMutex ( bool  rec = true  )  [inline, explicit]

Definition at line 92 of file Mutex.h.


Member Function Documentation

template<bool mt_only>
bool llvm::sys::SmartMutex< mt_only >::acquire (  )  [inline]

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.

Reimplemented from llvm::sys::MutexImpl.

Definition at line 95 of file Mutex.h.

Referenced by llvm::Type::addAbstractTypeUser(), llvm::llvm_acquire_global_lock(), llvm::MutexGuard::MutexGuard(), llvm::DerivedType::notifyUsesThatTypeBecameConcrete(), llvm::Timer::operator=(), llvm::Timer::print(), llvm::Type::removeAbstractTypeUser(), and llvm::DerivedType::unlockedRefineAbstractTypeTo().

template<bool mt_only>
bool llvm::sys::SmartMutex< mt_only >::release (  )  [inline]

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.

Reimplemented from llvm::sys::MutexImpl.

Definition at line 106 of file Mutex.h.

Referenced by llvm::Type::addAbstractTypeUser(), llvm::llvm_release_global_lock(), llvm::Timer::operator=(), llvm::Timer::print(), llvm::Type::removeAbstractTypeUser(), llvm::DerivedType::unlockedRefineAbstractTypeTo(), and llvm::MutexGuard::~MutexGuard().

template<bool mt_only>
bool llvm::sys::SmartMutex< mt_only >::tryacquire (  )  [inline]

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.

Reimplemented from llvm::sys::MutexImpl.

Definition at line 118 of file Mutex.h.


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