From e0b3c02c095d11fbc05ad7d156f929ac16f2d9c0 Mon Sep 17 00:00:00 2001 From: Geod24 Date: Mon, 15 Feb 2021 18:33:43 +0900 Subject: [PATCH] SelectState: Instantiate the FiberBlocker in the caller Remove dependency on the global state. --- source/geod24/concurrency.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/geod24/concurrency.d b/source/geod24/concurrency.d index 7b71a313..779e5a0a 100644 --- a/source/geod24/concurrency.d +++ b/source/geod24/concurrency.d @@ -728,7 +728,7 @@ public SelectReturn select (ref SelectEntry[] read_list, ref SelectEntry[] write { import std.random : randomShuffle; - auto ss = new SelectState(); + auto ss = new SelectState(thisScheduler().new FiberBlocker()); int sel_id = 0; thisScheduler().addResource(ss); scope (exit) thisScheduler().removeResource(ss); @@ -775,9 +775,9 @@ final private class SelectState : FiberScheduler.Resource ***********************************************************************/ - this () nothrow + this (FiberScheduler.FiberBlocker blocker) @safe pure nothrow @nogc { - this.blocker = thisScheduler().new FiberBlocker(); + this.blocker = blocker; } /***********************************************************************