Test that queues are flushed by clReleaseCommandQueue (#923)

... as required by the OpenCL specification.

Also introduce a utility function to manage polling for changes
via a user-supplied function. Several tests we introduced lately
could have used this.

Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
Kévin Petit
2020-09-01 10:27:27 +01:00
committed by GitHub
parent e075026819
commit f06e1896a8
6 changed files with 93 additions and 0 deletions

View File

@@ -1693,3 +1693,23 @@ Version get_max_OpenCL_C_for_context(cl_context context)
});
return current_version;
}
bool poll_until(unsigned timeout_ms, unsigned interval_ms,
std::function<bool()> fn)
{
unsigned time_spent_ms = 0;
bool ret = false;
while (time_spent_ms < timeout_ms)
{
ret = fn();
if (ret)
{
break;
}
usleep(interval_ms * 1000);
time_spent_ms += interval_ms;
}
return ret;
}