@@ -177,7 +177,7 @@ class timeoutTemplate
177
177
178
178
bool canWait () const
179
179
{
180
- return _timeout != alwaysExpired;
180
+ return _timeout != alwaysExpired && !_oneShotExpired ;
181
181
}
182
182
183
183
// Resets, will trigger after this new timeout.
@@ -194,6 +194,7 @@ class timeoutTemplate
194
194
void reset ()
195
195
{
196
196
_start = TimePolicyT::time ();
197
+ _oneShotExpired = false ;
197
198
}
198
199
199
200
// Resets to just expired so that on next poll the check will immediately trigger for the user,
@@ -246,8 +247,8 @@ class timeoutTemplate
246
247
bool checkExpired (const timeType internalUnit) const
247
248
{
248
249
// canWait() is not checked here
249
- // returns "can expire" and "time expired"
250
- return (!_neverExpires) && ((internalUnit - _start) >= _timeout);
250
+ // returns "can expire" and "oneshot not expired" and " time expired"
251
+ return (_oneShotExpired) || (( !_neverExpires) && ((internalUnit - _start) >= _timeout) );
251
252
}
252
253
253
254
protected:
@@ -275,7 +276,7 @@ class timeoutTemplate
275
276
if (!canWait ()) return true ;
276
277
if (checkExpired (TimePolicyT::time ()))
277
278
{
278
- _timeout = alwaysExpired ;
279
+ _oneShotExpired = true ;
279
280
return true ;
280
281
}
281
282
return false ;
@@ -284,6 +285,7 @@ class timeoutTemplate
284
285
timeType _timeout;
285
286
timeType _start;
286
287
bool _neverExpires;
288
+ bool _oneShotExpired;
287
289
};
288
290
289
291
// legacy type names, deprecated (unit is milliseconds)
0 commit comments