LLVM  8.0.1
List of all members
llvm::sys::MutexImpl Class Reference

Platform agnostic Mutex class. More...

#include "llvm/Support/Mutex.h"

Public Member Functions

Constructors
 MutexImpl (bool recursive=true)
 Initializes the lock but doesn't acquire it. More...
 
 ~MutexImpl ()
 Releases and removes the lock Destructor. More...
 
Methods
bool acquire ()
 Attempts to unconditionally acquire the lock. More...
 
bool release ()
 Attempts to release the lock. More...
 
bool tryacquire ()
 Attempts to acquire the lock without blocking. More...
 

Detailed Description

Platform agnostic Mutex class.

Definition at line 27 of file Mutex.h.

Constructor & Destructor Documentation

◆ MutexImpl()

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

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). Default Constructor.

Definition at line 45 of file Mutex.cpp.

References assert(), and llvm::safe_malloc().

◆ ~MutexImpl()

llvm::MutexImpl::~MutexImpl ( )

Releases and removes the lock Destructor.

Definition at line 77 of file Mutex.cpp.

References assert().

Member Function Documentation

◆ acquire()

bool llvm::MutexImpl::acquire ( )

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. Unconditionally acquire the lock.

Definition at line 86 of file Mutex.cpp.

References assert().

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

◆ release()

bool llvm::MutexImpl::release ( )

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. Unconditionally release the lock.

Definition at line 96 of file Mutex.cpp.

References assert().

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

◆ tryacquire()

bool llvm::MutexImpl::tryacquire ( )

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. Try to acquire the lock.

Definition at line 106 of file Mutex.cpp.

References assert().

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


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