Skip to content

Commit e52ecde

Browse files
committed
Merge pull request dmlc#38 from dmlc/concurrency-fix-for-gcc-4.8
[concurrency-fix-for-gcc-4.8] member initialization doesn't work on G++ 4.8
2 parents cf491a1 + 6259941 commit e52ecde

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/dmlc/concurrency.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Spinlock {
4646
template <typename T>
4747
class ConcurrentBlockingQueue {
4848
public:
49-
ConcurrentBlockingQueue() = default;
49+
ConcurrentBlockingQueue();
5050
~ConcurrentBlockingQueue() = default;
5151
/*!
5252
* \brief Push element into the queue.
@@ -83,7 +83,7 @@ class ConcurrentBlockingQueue {
8383
private:
8484
std::mutex mutex_;
8585
std::condition_variable cv_;
86-
std::atomic<bool> exit_now_{false};
86+
std::atomic<bool> exit_now_;
8787
std::list<T> queue_;
8888
/*!
8989
* \brief Disable copy and move.
@@ -100,6 +100,9 @@ inline void Spinlock::unlock() noexcept {
100100
lock_.clear(std::memory_order_release);
101101
}
102102

103+
template <typename T>
104+
ConcurrentBlockingQueue<T>::ConcurrentBlockingQueue() : exit_now_{false} {}
105+
103106
template <typename T>
104107
template <typename E>
105108
void ConcurrentBlockingQueue<T>::Push(E&& e) {

0 commit comments

Comments
 (0)