Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 79e9b2db1a9c
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2b0178f1ab8a
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Mar 30, 2015

  1. Copy the full SHA
    c44a4a6 View commit details
  2. Copy the full SHA
    2b0178f View commit details
5 changes: 4 additions & 1 deletion lib/ruby/truffle/mri/thread.rb
Original file line number Diff line number Diff line change
@@ -269,6 +269,7 @@ class SizedQueue < Queue
# Creates a fixed-length queue with a maximum size of +max+.
#
def initialize(max)
max = Rubinius::Type.num2long(max)
raise ArgumentError, "queue size must be positive" unless max > 0
@max = max
@enque_cond = ConditionVariable.new
@@ -287,6 +288,7 @@ def max
# Sets the maximum size of the queue.
#
def max=(max)
max = Rubinius::Type.num2long(max)
raise ArgumentError, "queue size must be positive" unless max > 0

@mutex.synchronize do
@@ -307,11 +309,12 @@ def max=(max)
# Pushes +obj+ to the queue. If there is no space left in the queue, waits
# until space becomes available.
#
def push(obj)
def push(obj, non_block=false)
Thread.handle_interrupt(RuntimeError => :on_blocking) do
@mutex.synchronize do
while true
break if @que.length < @max
raise ThreadError, "queue full" if non_block
@num_enqueue_waiting += 1
begin
@enque_cond.wait @mutex

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/library/thread/sizedqueue/enq_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/library/thread/sizedqueue/max_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/library/thread/sizedqueue/new_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/library/thread/sizedqueue/push_tags.txt

This file was deleted.