File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import juno.base.core,
1919import std.algorithm ;
2020import std.array ;
2121import std.utf : toUTF8, toUTF16z;
22- import core.exception , core.memory ;
22+ import core.atomic , core. exception , core.memory ;
2323import core.stdc.wchar_ : wcslen;
2424
2525import std.system ;
@@ -3147,17 +3147,17 @@ template QueryInterfaceImpl(TList...) {
31473147// Implements AddRef & Release for IUnknown subclasses.
31483148template ReferenceCountImpl () {
31493149
3150- private int refCount_ = 1 ;
3151- private bool finalized_;
3150+ private shared int refCount_ = 1 ;
3151+ private shared bool finalized_;
31523152
31533153 extern (Windows ):
31543154
31553155 uint AddRef () {
3156- return InterlockedIncrement (refCount_);
3156+ return atomicOp ! " += " (refCount_, 1 );
31573157 }
31583158
31593159 uint Release () {
3160- if (InterlockedDecrement (refCount_) == 0 ) {
3160+ if (atomicOp ! " -= " (refCount_, 1 ) == 0 ) {
31613161 if (! finalized_) {
31623162 finalized_ = true ;
31633163 runFinalizer(this );
You can’t perform that action at this time.
0 commit comments