common::SafeData< T > Class Template Reference

#include <thread.h>

Collaboration diagram for common::SafeData< T >:
Collaboration graph
[legend]

Public Member Functions

 SafeData ()
 Constructors and destructors.
 ~SafeData ()
get_value ()
 Safely get the value.
void set_value (const T &new_value)
 Safely set the value.

Detailed Description

template<typename T>
class common::SafeData< T >

Definition at line 44 of file thread.h.


Constructor & Destructor Documentation

template<typename T >
common::SafeData< T >::SafeData (  )  [inline]

Constructors and destructors.

Definition at line 48 of file thread.h.

00049     {
00050         g_static_rw_lock_init(&rw_lock);
00051     }

template<typename T >
common::SafeData< T >::~SafeData (  )  [inline]

Definition at line 52 of file thread.h.

00053     {
00054         g_static_rw_lock_free(&rw_lock);
00055     }


Member Function Documentation

template<typename T >
T common::SafeData< T >::get_value (  )  [inline]

Safely get the value.

Definition at line 58 of file thread.h.

00059     {
00060         
00061         g_static_rw_lock_reader_lock(&rw_lock);
00062         T tmp = data;
00063         g_static_rw_lock_reader_unlock(&rw_lock);
00064 
00065         return tmp;
00066     }

template<typename T >
void common::SafeData< T >::set_value ( const T &  new_value  )  [inline]

Safely set the value.

Definition at line 69 of file thread.h.

00070     {
00071         g_static_rw_lock_writer_lock(&rw_lock);
00072         data = new_value;
00073         g_static_rw_lock_writer_unlock(&rw_lock);
00074     }


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208