5 #ifndef CVMFS_UTIL_FUTURE_H_
6 #define CVMFS_UTIL_FUTURE_H_
15 #ifdef CVMFS_NAMESPACE_GUARD
16 namespace CVMFS_NAMESPACE_GUARD {
35 int retval = pthread_mutex_init(&mutex_, NULL);
37 retval = pthread_cond_init(&object_set_, NULL);
42 int retval = pthread_cond_destroy(&object_set_);
44 retval = pthread_mutex_destroy(&mutex_);
53 void Set(
const T &
object) {
57 object_was_set_ =
true;
58 pthread_cond_broadcast(&object_set_);
71 const T&
Get()
const {
79 while (!object_was_set_) {
80 pthread_cond_wait(&object_set_, &mutex_);
90 #ifdef CVMFS_NAMESPACE_GUARD
94 #endif // CVMFS_UTIL_FUTURE_H_
pthread_cond_t object_set_
assert((mem||(size==0))&&"Out Of Memory")
void Set(const T &object)