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.
This commit is contained in:
Sönke Ludwig 2017-03-27 16:31:52 +02:00
parent e81589fa3e
commit 0895cd1960
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -337,8 +337,11 @@ nothrow @safe:
bool consume(ref TaskFuncInfo tfi) bool consume(ref TaskFuncInfo tfi)
{ {
import std.algorithm.mutation : swap;
if (m_queue.empty) return false; if (m_queue.empty) return false;
m_queue.read(() @trusted { return (&tfi)[0 .. 1]; } ()); swap(tfi, m_queue.front);
m_queue.popFront();
return true; return true;
} }
} }