SingleAssignmentDisposable

Members

Functions

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

Inherited Members

From Cancelable

isDisposed
bool isDisposed()

Examples

1 int count = 0;
2 class TestDisposable : Disposable
3 {
4     void dispose()
5     {
6         count++;
7     }
8 }
9 
10 auto temp = new SingleAssignmentDisposable;
11 temp.setDisposable(new TestDisposable);
12 assert(!temp.isDisposed);
13 assert(count == 0);
14 temp.dispose();
15 assert(temp.isDisposed);
16 assert(count == 1);