From 0895cd1960619e94bedf5216de811dd48d26853a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Mon, 27 Mar 2017 16:31:52 +0200 Subject: [PATCH] Avoid bogus assertion failure. Since the task queue entries never got cleaned up, the assertion got triggered once already used queue slots were starting to get reused. --- source/vibe/core/taskpool.d | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/vibe/core/taskpool.d b/source/vibe/core/taskpool.d index 55058f7..84dea9f 100644 --- a/source/vibe/core/taskpool.d +++ b/source/vibe/core/taskpool.d @@ -337,8 +337,11 @@ nothrow @safe: bool consume(ref TaskFuncInfo tfi) { + import std.algorithm.mutation : swap; + if (m_queue.empty) return false; - m_queue.read(() @trusted { return (&tfi)[0 .. 1]; } ()); + swap(tfi, m_queue.front); + m_queue.popFront(); return true; } }