Fix naming of the argument

Change-Id: Ice5ab90ddfee0e1273e0607cb1c3251b1435b6dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179924
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski
2025-01-08 06:26:51 +01:00
parent fa9d3f5706
commit 158e43c438

View File

@ -18,19 +18,19 @@ namespace sal::systools
{
// Some system calls (e.g., clipboard access functions) may fail first time, because the resource
// may only be accessed by one process at a time. This function allows to retry failed call up to
// specified number of times with a specified timeout (in ms), until the call succeeds or the limit
// specified number of times with a specified interval (in ms), until the call succeeds or the limit
// of attempts is exceeded.
// Usage:
// HRESULT hr = sal::systools::RetryIfFailed(10, 100, []{ return OleFlushClipboard(); });
template <typename Func>
std::enable_if_t<std::is_same_v<std::invoke_result_t<Func>, HRESULT>, HRESULT>
RetryIfFailed(unsigned times, unsigned msTimeout, Func func)
RetryIfFailed(unsigned times, unsigned msInterval, Func func)
{
for (unsigned i = 0;; ++i)
{
if (HRESULT hr = func(); SUCCEEDED(hr) || i >= times)
return hr;
Sleep(msTimeout);
Sleep(msInterval);
}
}
}