Allow Task.interrupt to be called within a yieldLock.

This commit is contained in:
Sönke Ludwig 2019-01-22 11:39:31 +01:00
parent 03ffe70dc1
commit b5ccb784a1

View file

@ -491,7 +491,9 @@ final package class TaskFiber : Fiber {
} else assert(() @trusted { return Thread.getThis(); } () is this.thread, "Interrupting tasks in different threads is not yet supported.");
debug (VibeTaskLog) logTrace("Resuming task with interrupt flag.");
m_interrupt = true;
taskScheduler.switchTo(this.task);
auto defer = TaskFiber.getThis().m_yieldLockCount > 0 ? Yes.defer : No.defer;
taskScheduler.switchTo(this.task, defer);
}
void bumpTaskCounter()