diff options
| author | Luke Gruber <luke.gruber@shopify.com> | 2026-01-28 12:32:59 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-28 12:32:59 -0500 |
| commit | 8d41e57efe2e985e9496e91d63ba25ef0df2399b (patch) | |
| tree | 5d0282f989a21fd143cd1fced3cf8386ff5bc8ee /test/ruby | |
| parent | 01ace0655ed84708f0afdcc74fb779e680bfc4e0 (diff) | |
Revert "Prevent starvation when acquiring mutex over and over (#15877)" (#15990)
This reverts commit 994257ab06072df38de024e70a60aa9a87e36089.
I saw some failures in CI that are probably related to the change.
Example:
```
1) Failure:
TestMonitor#test_timedwait [/Users/runner/work/ruby/ruby/src/test/monitor/test_monitor.rb:282]:
```
This starvation problem has not been an issue in real apps afaik, so for now it's best to revert
it and think of a better solution.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_thread.rb | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 47a8e94c07..b2d8e73693 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -1664,39 +1664,4 @@ q.pop assert_operator elapsed, :>=, 0.1, "sub-millisecond sleeps should not return immediately" end; end - - # [Bug #21840] - def test_mutex_owner_doesnt_starve_waiters - assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") - begin; - require "tempfile" - temp = Tempfile.new("temp") - m = Mutex.new - - def fib(n) - return n if n <= 1 - fib(n - 1) + fib(n - 2) - end - - t1_running = false - Thread.new do - t1_running = true - loop do - fib(20) - m.synchronize do - File.open(temp.path) { } # reset timeslice due to blocking operation - end - end - end - - loop until t1_running - - 3.times.map do - Thread.new do - m.synchronize do - end - end - end.each(&:join) - end; - end end |
