19#ifndef HEADER_SYNCHRONISED_HPP 
   20#define HEADER_SYNCHRONISED_HPP 
   26template<
typename TYPE>
 
   71        std::unique_lock<std::mutex> ul(
m_mutex);
 
  104                              { 
return std::unique_lock<std::mutex>(
m_mutex); }
 
A variable that is automatically synchronised using pthreads mutex.
Definition: synchronised.hpp:28
 
TYPE & getData()
Returns a reference to the original data file.
Definition: synchronised.hpp:82
 
void lock() const
Locks the mutex.
Definition: synchronised.hpp:95
 
void setAtomic(const TYPE &v)
Sets the value of this variable using a mutex.
Definition: synchronised.hpp:59
 
Synchronised()
Initialise the data and the mutex with default constructors.
Definition: synchronised.hpp:37
 
Synchronised(const TYPE &v)
Initialise the data and the mutex.
Definition: synchronised.hpp:43
 
void unlock() const
Unlocks the mutex.
Definition: synchronised.hpp:99
 
std::mutex m_mutex
The mutex to protect this variable with.
Definition: synchronised.hpp:31
 
TYPE m_data
The actual data to be used.
Definition: synchronised.hpp:33
 
std::unique_lock< std::mutex > acquireMutex() const
Gives unique_lock to the mutex, which can then be used by std::condition_variable wait.
Definition: synchronised.hpp:103
 
TYPE getAtomic() const
Returns a copy of this variable.
Definition: synchronised.hpp:68
 
~Synchronised()
Destroy this mutex.
Definition: synchronised.hpp:51