From f263c6014e4e5c66fb6aa1a6aa8d67d2d105ea52 Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Sun, 6 Jul 2014 18:47:48 +0200 Subject: [PATCH] fix wait_pull_front in case the queue is closed while empty. --- include/boost/thread/sync_queue.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/thread/sync_queue.hpp b/include/boost/thread/sync_queue.hpp index 8e4bc93c..489cd252 100644 --- a/include/boost/thread/sync_queue.hpp +++ b/include/boost/thread/sync_queue.hpp @@ -320,7 +320,9 @@ namespace boost { if (closed(lk)) return queue_op_status::closed; } - wait_until_not_empty(lk); + bool has_been_closed = false; + wait_until_not_empty(lk, has_been_closed); + if (has_been_closed) return queue_op_status::closed; pull_front(elem, lk); return queue_op_status::success; }