We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1cd7b86 commit 5f1b898Copy full SHA for 5f1b898
lib/mpv/fence.rb
@@ -45,6 +45,15 @@ def wait1(timeout: DEFAULT_TIMEOUT)
45
wait(runs: 1, timeout: timeout).first
46
end
47
48
+ def wait_until(timeout: DEFAULT_TIMEOUT, &block)
49
+ start = Concurrent.monotonic_time
50
+ loop do
51
+ x = wait1(timeout: timeout / 10)
52
+ break if block.call(x)
53
+ break if (Concurrent.monotonic_time - start) >= timeout
54
+ end
55
56
+
57
# Clears the calls history
58
def clear!
59
@mutex.synchronize do
0 commit comments