static one_hour

This commit is contained in:
gabime
2014-03-01 14:38:12 +02:00
parent ddcf45d65f
commit 50b81974e3
4 changed files with 9 additions and 10 deletions

View File

@@ -58,7 +58,8 @@ public:
// If the queue is full, block the calling thread until there is room.
template<typename TT>
void push(TT&& item) {
while (!push(std::forward<TT>(item), _one_hour));
static constexpr std::chrono::hours one_hour(1);
while (!push(std::forward<TT>(item), one_hour));
}
// Pop a copy of the front item in the queue into the given item ref.
@@ -85,7 +86,8 @@ public:
// Pop a copy of the front item in the queue into the given item ref.
// If the queue is empty, block the calling thread util there is item to pop.
void pop(T& item) {
while (!pop(item, _one_hour));
static constexpr std::chrono::hours one_hour(1);
while (!pop(item, one_hour));
}
// Clear the queue
@@ -103,7 +105,6 @@ private:
std::mutex _mutex;
std::condition_variable _item_pushed_cond;
std::condition_variable _item_popped_cond;
static constexpr auto _one_hour = std::chrono::hours(1);
};
}