From 8f4222916f83ee55b95933767f27b8a9ee7e383c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Sun, 10 Apr 2016 14:20:05 +0200 Subject: [PATCH] Weaken the task double-resumption assertion condition. This assertion got triggered in a number of harmless situations and it's not always easy to avoid. Trying to avoid it, it has already caused a rather bad task starvation bug (#1441), so at this point it seems to be better to get rid of it. See also #1407 (cherry picked from commit 621e34b388848c762a7525149ea449ad082996a1) --- source/vibe/core/core.d | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/vibe/core/core.d b/source/vibe/core/core.d index 1d66cca..486aa0b 100644 --- a/source/vibe/core/core.d +++ b/source/vibe/core/core.d @@ -1274,13 +1274,16 @@ package(vibe) void resumeCoreTask(CoreTask ctask, Exception event_exception = nu nothrow @safe { assert(ctask.thread is () @trusted { return Thread.getThis(); } (), "Resuming task in foreign thread."); assert(() @trusted nothrow { return ctask.state; } () == Fiber.State.HOLD, "Resuming fiber that is not on HOLD"); - assert(ctask.m_queue is null, "Manually resuming task that is already scheduled to be resumed."); - if( event_exception ){ + if (event_exception) { extrap(); + assert(!ctask.m_exception, "Resuming task with exception that is already scheduled to be resumed with exception."); ctask.m_exception = event_exception; } + // do nothing if the task is aready scheduled to be resumed + if (ctask.m_queue) return; + auto uncaught_exception = () @trusted nothrow { return ctask.call!(Fiber.Rethrow.no)(); } (); if (uncaught_exception) {