Skip to content

Commit c767556

Browse files
author
Oren (electricessence)
committed
cleanup.
1 parent b8e04e5 commit c767556

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

AsyncDisposableBase.cs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ namespace Open.Disposable
1111
/// A base class for properly implementing IAsyncDisposable but also allowing for synchronous use of IDispose.
1212
/// Only implementing OnDisposeAsync is enough to properly handle disposal.
1313
/// </summary>
14-
public abstract class AsyncDisposableBase : DisposableStateBase
14+
public abstract class AsyncDisposableBase : DisposableStateBase
1515
#if NETSTANDARD2_1
16-
,System.IAsyncDisposable
16+
, System.IAsyncDisposable
1717
#endif
1818
{
1919
/// <summary>
@@ -24,45 +24,45 @@ public abstract class AsyncDisposableBase : DisposableStateBase
2424

2525
/// <inheritdoc />
2626
public ValueTask DisposeAsync()
27-
{
28-
/*
27+
{
28+
/*
2929
* Note about the BeforeDispose event:
3030
* Although this is asynchronous, it's not this class' responsibility to decide how subscribers will behave.
3131
* A subscriber should smartly defer responses when possible, or only respond in a properly synchronous non-blockin way.
3232
*/
3333

34-
if (!StartDispose())
35-
return new ValueTask();
34+
if (!StartDispose())
35+
return new ValueTask();
3636

37-
var dispose = true;
38-
try
39-
{
40-
var d = OnDisposeAsync();
41-
if (!d.IsCompletedSuccessfully)
42-
{
43-
dispose = false;
44-
return OnDisposeAsyncInternal(d);
45-
}
46-
}
47-
finally
48-
{
49-
if (dispose) Disposed();
50-
}
37+
var dispose = true;
38+
try
39+
{
40+
var d = OnDisposeAsync();
41+
if (!d.IsCompletedSuccessfully)
42+
{
43+
dispose = false;
44+
return OnDisposeAsyncInternal(d);
45+
}
46+
}
47+
finally
48+
{
49+
if (dispose) Disposed();
50+
}
5151

52-
return new ValueTask();
53-
}
52+
return new ValueTask();
53+
}
5454

55-
private async ValueTask OnDisposeAsyncInternal(ValueTask onDispose)
56-
{
57-
try
58-
{
59-
await onDispose;
60-
}
61-
finally
62-
{
63-
Disposed();
64-
}
65-
}
55+
private async ValueTask OnDisposeAsyncInternal(ValueTask onDispose)
56+
{
57+
try
58+
{
59+
await onDispose;
60+
}
61+
finally
62+
{
63+
Disposed();
64+
}
65+
}
6666

67-
}
67+
}
6868
}

DisposeHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public DisposeHandler(Action action)
1818

1919
protected override void OnDispose()
2020
=> Nullify(ref _action).Invoke();
21-
21+
2222
}
2323

2424
public class DisposeHandler<T> : DisposeHandler
2525
{
26-
public DisposeHandler(T value, Action action) :base(action)
26+
public DisposeHandler(T value, Action action) : base(action)
2727
{
2828
Value = value;
2929
}

IDisposalState.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* @author electricessence / https://github.com/electricessence/
33
* Licensing: MIThttps://github.com/electricessence/Open.Disposable/blob/master/LISCENSE.md
44
*/
5-
6-
namespace Open.Disposable
5+
6+
namespace Open.Disposable
77
{
8-
public interface IDisposalState
8+
public interface IDisposalState
99
{
1010
bool WasDisposed { get; }
1111
}

0 commit comments

Comments
 (0)