CernVM-FS  2.11.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Future< T > Class Template Reference

#include <concurrency.h>

Inheritance diagram for Future< T >:
Collaboration diagram for Future< T >:

Public Member Functions

 Future ()
 
virtual ~Future ()
 
void Set (const T &object)
 
T & Get ()
 
const T & Get () const
 

Protected Member Functions

void Wait () const
 

Private Attributes

object_
 
pthread_mutex_t mutex_
 
pthread_cond_t object_set_
 
bool object_was_set_
 

Additional Inherited Members

- Private Member Functions inherited from SingleCopy
 SingleCopy ()
 

Detailed Description

template<typename T>
class Future< T >

This is a simple implementation of a Future wrapper template. It is used as a proxy for results that are computed asynchronously and might not be available on the first access. Since this is a very simple implementation one needs to use the Future's Get() and Set() methods to obtain the containing data resp. to write it. Note: More than a single call to Set() is prohibited! If Get() is called before Set() the calling thread will block until the value has been set by a different thread.

Parameters
Tthe value type wrapped by this Future template

Definition at line 67 of file concurrency.h.

Constructor & Destructor Documentation

template<typename T >
Future< T >::Future ( )

This file is part of the CernVM File System.

Definition at line 21 of file concurrency_impl.h.

Here is the call graph for this function:

template<typename T >
Future< T >::~Future ( )
virtual

Definition at line 29 of file concurrency_impl.h.

Member Function Documentation

template<typename T >
const T & Future< T >::Get ( ) const

Definition at line 63 of file concurrency_impl.h.

template<typename T >
void Future< T >::Wait ( ) const
protected

Definition at line 46 of file concurrency_impl.h.

Here is the call graph for this function:

Member Data Documentation

template<typename T>
pthread_mutex_t Future< T >::mutex_
mutableprivate

Definition at line 92 of file concurrency.h.

Referenced by Future< T >::Future().

template<typename T>
T Future< T >::object_
private

Definition at line 91 of file concurrency.h.

template<typename T>
pthread_cond_t Future< T >::object_set_
mutableprivate

Definition at line 93 of file concurrency.h.

Referenced by Future< T >::Future().

template<typename T>
bool Future< T >::object_was_set_
private

Definition at line 94 of file concurrency.h.


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