A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicFixnum.html below:

Class: Concurrent::AtomicFixnum — Concurrent Ruby

Class: Concurrent::AtomicFixnum
Inherits:
AtomicFixnumImplementation show all
Defined in:
lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb
Overview

A numeric value that can be updated atomically. Reads and writes to an atomic fixnum and thread-safe and guaranteed to succeed. Reads and writes may block briefly but no explicit locking is required.

Thread-safe Variable Classes

Each of the thread-safe variable classes is designed to solve a different problem. In general:

Testing with ruby 2.1.2
Testing with Concurrent::MutexAtomicFixnum...
  3.130000   0.000000   3.130000 (  3.136505)
Testing with Concurrent::CAtomicFixnum...
  0.790000   0.000000   0.790000 (  0.785550)

Testing with jruby 1.9.3
Testing with Concurrent::MutexAtomicFixnum...
  5.460000   2.460000   7.920000 (  3.715000)
Testing with Concurrent::JavaAtomicFixnum...
  4.520000   0.030000   4.550000 (  1.187000)
Instance Method Summary collapse Constructor Details #initialize(initial = 0) ⇒ undocumented

Creates a new AtomicFixnum with the given initial value.

136
137
138
139
140
141
142
143
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb', line 136

class AtomicFixnum < AtomicFixnumImplementation
    def to_s
    format '%s value:%s>', super[0..-2], value
  end

  alias_method :inspect, :to_s
end
Instance Method Details #compare_and_set(expect, update) ⇒ Boolean

Atomically sets the value to the given updated value if the current value == the expected value.

136
137
138
139
140
141
142
143
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb', line 136

class AtomicFixnum < AtomicFixnumImplementation
    def to_s
    format '%s value:%s>', super[0..-2], value
  end

  alias_method :inspect, :to_s
end
#decrement(delta = 1) ⇒ Fixnum

Decreases the current value by the given amount (defaults to 1).

136
137
138
139
140
141
142
143
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb', line 136

class AtomicFixnum < AtomicFixnumImplementation
    def to_s
    format '%s value:%s>', super[0..-2], value
  end

  alias_method :inspect, :to_s
end
#increment(delta = 1) ⇒ Fixnum

Increases the current value by the given amount (defaults to 1).

136
137
138
139
140
141
142
143
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb', line 136

class AtomicFixnum < AtomicFixnumImplementation
    def to_s
    format '%s value:%s>', super[0..-2], value
  end

  alias_method :inspect, :to_s
end
#to_s ⇒ String Also known as: inspect

Returns Short string representation.

138
139
140
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb', line 138

def to_s
  format '%s value:%s>', super[0..-2], value
end
#update {|Object| ... } ⇒ Object

Pass the current value to the given block, replacing it with the block's result. May retry if the value changes during the block's execution.

136
137
138
139
140
141
142
143
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb', line 136

class AtomicFixnum < AtomicFixnumImplementation
    def to_s
    format '%s value:%s>', super[0..-2], value
  end

  alias_method :inspect, :to_s
end
#value ⇒ Fixnum

Retrieves the current Fixnum value.

136
137
138
139
140
141
142
143
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb', line 136

class AtomicFixnum < AtomicFixnumImplementation
    def to_s
    format '%s value:%s>', super[0..-2], value
  end

  alias_method :inspect, :to_s
end
#value=(value) ⇒ Fixnum

Explicitly sets the value.

136
137
138
139
140
141
142
143
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb', line 136

class AtomicFixnum < AtomicFixnumImplementation
    def to_s
    format '%s value:%s>', super[0..-2], value
  end

  alias_method :inspect, :to_s
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4