SingleAssignmentDisposable

Members

Functions

dispose
void dispose()
isDisposed
bool isDisposed()
setDisposable
void setDisposable(Disposable disposable)

Inherited Members

From Cancelable

isDisposed
bool isDisposed()

Examples

int count = 0;
class TestDisposable : Disposable
{
    void dispose()
    {
        count++;
    }
}

auto temp = new SingleAssignmentDisposable;
temp.setDisposable(new TestDisposable);
assert(!temp.isDisposed);
assert(count == 0);
temp.dispose();
assert(temp.isDisposed);
assert(count == 1);

Meta