From 7e6e87e687180e76cb6f83e7273bd2ea4238d514 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Fri, 6 Dec 2024 16:47:17 +0100 Subject: [PATCH] at least one sleep --- wgpu/backends/wgpu_native/_helpers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wgpu/backends/wgpu_native/_helpers.py b/wgpu/backends/wgpu_native/_helpers.py index bbd2f742..2dfc8ba1 100644 --- a/wgpu/backends/wgpu_native/_helpers.py +++ b/wgpu/backends/wgpu_native/_helpers.py @@ -287,6 +287,10 @@ def __await__(self): # There is no documentation on what __await__() is supposed to return, but we # can certainly copy from a function that *does* know what to return async def wait_for_callback(): + # In all the async cases that I've tried, the result is either already set, or + # resolves after the first call to the poll function. To make sure that our + # sleep-logic actually works, we always do at least one sleep call. + await async_sleep(0) if self.result is not None: return if not self.poll_function: