LLVM API Documentation

Public Member Functions
llvm::sys::MutexImpl Class Reference

Platform agnostic Mutex class. More...

#include <Mutex.h>

List of all members.

Public Member Functions

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

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.

Destructor.

Releases and removes the lock

Definition at line 75 of file Mutex.cpp.

References llvm::LibFunc::free.


Member Function Documentation

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 84 of file Mutex.cpp.

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

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 94 of file Mutex.cpp.

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

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 104 of file Mutex.cpp.

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


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