From 2251a002840536e8dd72a1d37221eb76b67fe1f3 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Tue, 24 May 2022 19:23:46 +0200 Subject: [PATCH] Descriptor queue safety fix Fixed a bug whereby if one were to get new Descriptor classes across several threads then the Mutex for the descriptor queue would be reinitialzied upon static initialization of the thread as the static initialization block was not set to __gshared, causing a global re-write of a re-initted Mutex, never the same Mutex --- source/tasky/jobs.d | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/tasky/jobs.d b/source/tasky/jobs.d index b4ca9a3..2e0852f 100644 --- a/source/tasky/jobs.d +++ b/source/tasky/jobs.d @@ -110,11 +110,8 @@ public abstract class Descriptor : Signal /** * Static initialization of the descriptor * class ID queue's lock - * - * FIXME: BIG BUG FOR MULTITHREADED THIS MUST BE SET TO GSHARED TOO, else each thread - * will be overwriting the global descQueuLock */ - static this() + __gshared static this() { descQueueLock = new Mutex(); }