SG++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sgpp::optimization::MutexType Class Reference

Wrapper for OpenMP nested locks. More...

#include <MutexType.hpp>

Public Member Functions

void lock ()
 Lock the MutexType. More...
 
 MutexType ()
 Constructor. More...
 
 MutexType (const MutexType &other)
 Custom copy constructor to prevent copying the lock. More...
 
MutexTypeoperator= (const MutexType &other)
 Custom assignment operator to prevent copying the lock. More...
 
void unlock ()
 Unlock the MutexType. More...
 
 ~MutexType ()
 Destructor. More...
 

Protected Attributes

omp_nest_lock_t _lock
 OpenMP lock. More...
 

Detailed Description

Wrapper for OpenMP nested locks.

Once locked, other threads block when trying to lock the same MutexType. However, the MutexType can be locked multiple times by the same thread without blocking. In this case, it has to be unlocked the same number of times to let the other threads continuing execution.

Adopted from http://bisqwit.iki.fi/story/howto/openmp/#Locks.

Constructor & Destructor Documentation

sgpp::optimization::MutexType::MutexType ( )
inline

Constructor.

References _lock.

sgpp::optimization::MutexType::MutexType ( const MutexType other)
inline

Custom copy constructor to prevent copying the lock.

Parameters
otherobject to be copied

References _lock.

sgpp::optimization::MutexType::~MutexType ( )
inline

Destructor.

References _lock.

Member Function Documentation

MutexType& sgpp::optimization::MutexType::operator= ( const MutexType other)
inline

Custom assignment operator to prevent copying the lock.

Parameters
otherobject to be assigned to
Returns
*this
void sgpp::optimization::MutexType::unlock ( )
inline

Member Data Documentation

omp_nest_lock_t sgpp::optimization::MutexType::_lock
protected

OpenMP lock.

Referenced by lock(), MutexType(), unlock(), and ~MutexType().


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