You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Spins while <paramref name="lifetime"/> is alive, <paramref name="timeout"/> is not elapsed and <paramref name="condition"/> is false.
54
+
/// Spins while <paramref name="lifetime"/> is alive, <paramref name="timeout"/> is not elapsed and <paramref name="condition"/> is false.
53
55
/// </summary>
54
56
/// <param name="lifetime">Stops spinning and return <c>false</c> when lifetime is no more alive</param>
55
57
/// <param name="timeout">Stops spinning and return <c>false</c> when timeout is alive</param>
56
58
/// <param name="condition">Stops spinning and return <c>false</c> when condition is true</param>
57
-
/// <returns><c>false</c> if <paramref name="lifetime"/> is not alive or canceled during spinning, <paramref name="timeout"/> is zero or elapsed during spinning.
/// Spins while <paramref name="lifetime"/> is alive, <paramref name="timeoutMs"/> is not elapsed and <paramref name="condition"/> is false.
86
+
/// Spins while <paramref name="lifetime"/> is alive, <paramref name="timeoutMs"/> is not elapsed and <paramref name="condition"/> is false.
68
87
/// </summary>
69
88
/// <param name="lifetime">Stops spinning and return <c>false</c> when lifetime is no more alive</param>
70
89
/// <param name="timeoutMs">Stops spinning and return <c>false</c> when timeout is alive</param>
71
90
/// <param name="condition">Stops spinning and return <c>false</c> when condition is true</param>
72
-
/// <returns><c>false</c> if <paramref name="lifetime"/> is not alive or canceled during spinning, <paramref name="timeoutMs"/> is zero or elapsed during spinning.
@@ -84,9 +107,9 @@ public static bool SpinUntil(Lifetime lifetime, long timeoutMs, Func<bool> condi
84
107
if(!lifetime.IsAlive)
85
108
returnfalse;
86
109
87
-
if(condition())
110
+
if(condition(state))
88
111
returntrue;
89
-
112
+
90
113
if(Environment.TickCount-start>timeoutMs)
91
114
returnfalse;
92
115
@@ -95,27 +118,31 @@ public static bool SpinUntil(Lifetime lifetime, long timeoutMs, Func<bool> condi
95
118
#else
96
119
Thread.Sleep(0);
97
120
#endif
98
-
}
121
+
}
99
122
}
100
123
101
-
102
124
#if !NET35
103
125
/// <summary>
104
-
/// Spins in ASYNC manner (not consuming thread or CPU resources) while <paramref name="lifetime"/> is alive, <paramref name="timeoutMs"/> is not elapsed and <paramref name="condition"/> is false.
105
-
/// Sleeps in async fashion (using <see cref="System.Threading.Tasks.Task.Delay(System.TimeSpan, CancellationToken)"/> for <paramref name="delayBetweenChecksMs"/> each time between <paramref name="condition"/> check.
106
-
/// Only <paramref name="lifetime"/> cancellation could immediately return execution from delay.
126
+
/// Spins in ASYNC manner (not consuming thread or CPU resources) while <paramref name="lifetime"/> is alive,
127
+
/// <paramref name="timeoutMs"/> is not elapsed and <paramref name="condition"/> is false.
128
+
/// Sleeps in async fashion (using <see cref="System.Threading.Tasks.Task.Delay(System.TimeSpan, CancellationToken)"/>
129
+
/// for <paramref name="delayBetweenChecksMs"/> each time between <paramref name="condition"/> check.
130
+
/// Only <paramref name="lifetime"/> cancellation could immediately return execution from delay.
107
131
/// </summary>
108
132
/// <param name="lifetime">Stops spinning and return <c>false</c> when lifetime is no more alive</param>
109
133
/// <param name="timeoutMs">Stops spinning and return <c>false</c> when timeout is alive</param>
110
134
/// <param name="delayBetweenChecksMs">Interval to delay</param>
111
135
/// <param name="condition">Stops spinning and return <c>false</c> when condition is true</param>
112
-
/// <returns><c>false</c> if <paramref name="lifetime"/> is not alive or canceled during spinning, <paramref name="timeoutMs"/> is zero or elapsed during spinning.
0 commit comments