Skip to content

Commit 39c816c

Browse files
committed
added sleeptime optional arg
1 parent 28dabf2 commit 39c816c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gpu.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ template <typename T> T wait(Context &ctx, std::future<T> &f) {
869869
* Context ctx = waitForContextFuture(contextFuture);
870870
* @endcode
871871
*/
872-
template <typename T> T waitForContextFuture(std::future<T> &f) {
872+
template <typename T> T waitForContextFuture(std::future<T> &f, size_t sleepTime = 10) {
873873
#ifdef __EMSCRIPTEN__
874874
while (f.wait_for(std::chrono::milliseconds(0)) !=
875875
std::future_status::ready) {
@@ -879,7 +879,7 @@ template <typename T> T waitForContextFuture(std::future<T> &f) {
879879
#else
880880
while (f.wait_for(std::chrono::milliseconds(0)) !=
881881
std::future_status::ready) {
882-
std::this_thread::sleep_for(std::chrono::milliseconds(10));
882+
std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
883883
}
884884
return f.get();
885885
#endif

0 commit comments

Comments
 (0)