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