File tree 1 file changed +4
-3
lines changed
std/experimental/allocator
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -462,8 +462,8 @@ interface ISharedAllocator
462
462
private shared ISharedAllocator _processAllocator;
463
463
IAllocator _threadAllocator;
464
464
465
- static this ()
466
- {
465
+ private void setupThreadAllocator ()
466
+ @safe nothrow @nogc {
467
467
/*
468
468
Forwards the `_threadAllocator` calls to the `processAllocator`
469
469
*/
@@ -538,7 +538,7 @@ static this()
538
538
assert (! _threadAllocator);
539
539
import std.conv : emplace;
540
540
static ulong [stateSize! (ThreadAllocator).divideRoundUp(ulong .sizeof)] _threadAllocatorState;
541
- _threadAllocator = emplace! (ThreadAllocator)(_threadAllocatorState[]);
541
+ _threadAllocator = () @trusted { return emplace! (ThreadAllocator)(_threadAllocatorState[]); } ( );
542
542
}
543
543
544
544
/**
@@ -550,6 +550,7 @@ in turn uses the garbage collected heap.
550
550
*/
551
551
nothrow @safe @nogc @property IAllocator theAllocator()
552
552
{
553
+ if (! _threadAllocator) setupThreadAllocator();
553
554
return _threadAllocator;
554
555
}
555
556
You can’t perform that action at this time.
0 commit comments