From deb8b811d3c72139e10ab9ff5b7ead7116b3c165 Mon Sep 17 00:00:00 2001 From: Petr Chalupa Date: Tue, 30 Oct 2018 20:40:35 +0100 Subject: [PATCH 1/2] Update documentation for map --- docs/master/Concurrent/AtomicReference.html | 168 +- docs/master/Concurrent/Map.html | 2134 ++++++++++++++----- docs/master/file.CHANGELOG.html | 16 + docs/master/method_list.html | 1532 +++++++------ lib/concurrent/atomic/atomic_reference.rb | 1 + lib/concurrent/map.rb | 195 +- 6 files changed, 2613 insertions(+), 1433 deletions(-) diff --git a/docs/master/Concurrent/AtomicReference.html b/docs/master/Concurrent/AtomicReference.html index f14778bf0..c62aff7d3 100644 --- a/docs/master/Concurrent/AtomicReference.html +++ b/docs/master/Concurrent/AtomicReference.html @@ -429,18 +429,18 @@

 
 
-185
-186
-187
-188
-189
-190
-191
-192
-193
+195 +196 +197 +198 +199 +200 +201 +202 +203 -
# File 'lib/concurrent/atomic/atomic_reference.rb', line 185
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 195
 
 class AtomicReference < AtomicReferenceImplementation
 
@@ -542,18 +542,18 @@ 

 
 
-185
-186
-187
-188
-189
-190
-191
-192
-193
+195 +196 +197 +198 +199 +200 +201 +202 +203

-
# File 'lib/concurrent/atomic/atomic_reference.rb', line 185
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 195
 
 class AtomicReference < AtomicReferenceImplementation
 
@@ -611,18 +611,18 @@ 

 
 
-185
-186
-187
-188
-189
-190
-191
-192
-193
+195 +196 +197 +198 +199 +200 +201 +202 +203

-
# File 'lib/concurrent/atomic/atomic_reference.rb', line 185
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 195
 
 class AtomicReference < AtomicReferenceImplementation
 
@@ -699,18 +699,18 @@ 

 
 
-185
-186
-187
-188
-189
-190
-191
-192
-193
+195 +196 +197 +198 +199 +200 +201 +202 +203

-
# File 'lib/concurrent/atomic/atomic_reference.rb', line 185
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 195
 
 class AtomicReference < AtomicReferenceImplementation
 
@@ -787,18 +787,18 @@ 

 
 
-185
-186
-187
-188
-189
-190
-191
-192
-193
+195 +196 +197 +198 +199 +200 +201 +202 +203

-
# File 'lib/concurrent/atomic/atomic_reference.rb', line 185
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 195
 
 class AtomicReference < AtomicReferenceImplementation
 
@@ -860,12 +860,12 @@ 

 
 
-188
-189
-190
+198 +199 +200

-
# File 'lib/concurrent/atomic/atomic_reference.rb', line 188
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 198
 
 def to_s
   format '%s value:%s>', super[0..-2], get
@@ -964,18 +964,18 @@ 

 
 
-185
-186
-187
-188
-189
-190
-191
-192
-193
+195 +196 +197 +198 +199 +200 +201 +202 +203

-
# File 'lib/concurrent/atomic/atomic_reference.rb', line 185
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 195
 
 class AtomicReference < AtomicReferenceImplementation
 
@@ -1099,18 +1099,18 @@ 

 
 
-185
-186
-187
-188
-189
-190
-191
-192
-193
+195 +196 +197 +198 +199 +200 +201 +202 +203

-
# File 'lib/concurrent/atomic/atomic_reference.rb', line 185
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 195
 
 class AtomicReference < AtomicReferenceImplementation
 
@@ -1207,18 +1207,18 @@ 

 
 
-185
-186
-187
-188
-189
-190
-191
-192
-193
+195 +196 +197 +198 +199 +200 +201 +202 +203

-
# File 'lib/concurrent/atomic/atomic_reference.rb', line 185
+      
# File 'lib/concurrent/atomic/atomic_reference.rb', line 195
 
 class AtomicReference < AtomicReferenceImplementation
 
diff --git a/docs/master/Concurrent/Map.html b/docs/master/Concurrent/Map.html
index 2db3bae01..9dcb5930d 100644
--- a/docs/master/Concurrent/Map.html
+++ b/docs/master/Concurrent/Map.html
@@ -108,12 +108,6 @@ 

Overview

does. For most uses it should do fine though, and we recommend you consider Concurrent::Map instead of Concurrent::Hash for your concurrency-safe hash needs.

-
-

require 'concurrent'

- -

map = Concurrent::Map.new

-
-
@@ -138,7 +132,7 @@

  • - #[](key) ⇒ undocumented + #[](key) ⇒ Object @@ -154,7 +148,8 @@

    -
    +

    Get a value with key.

    +

  • @@ -162,7 +157,7 @@

  • - #compute ⇒ undocumented + #compute(key) {|old_value| ... } ⇒ Object? @@ -176,7 +171,7 @@

    -

    This method is atomic.

    +

    Compute and store new value for key.

  • @@ -185,7 +180,7 @@

  • - #compute_if_absent ⇒ undocumented + #compute_if_absent(key) { ... } ⇒ Object @@ -199,7 +194,7 @@

    -

    This method is atomic.

    +

    Compute and store new value for key if the key is absent.

  • @@ -208,7 +203,7 @@

  • - #compute_if_present ⇒ undocumented + #compute_if_present(key) {|old_value| ... } ⇒ Object? @@ -222,7 +217,7 @@

    -

    This method is atomic.

    +

    Compute and store new value for key if the key is present.

  • @@ -231,7 +226,7 @@

  • - #delete ⇒ undocumented + #delete(key) ⇒ Object? @@ -245,7 +240,7 @@

    -

    This method is atomic.

    +

    Delete key and its value.

  • @@ -254,7 +249,7 @@

  • - #delete_pair ⇒ undocumented + #delete_pair(key, value) ⇒ true, false @@ -268,7 +263,7 @@

    -

    This method is atomic.

    +

    Delete pair and its value if current value equals the provided value.

  • @@ -277,7 +272,7 @@

  • - #each_key ⇒ undocumented + #each_key {|key| ... } ⇒ self @@ -291,7 +286,8 @@

    -
    +

    Iterates over each key.

    +

  • @@ -299,7 +295,7 @@

  • - #each_pair ⇒ undocumented + #each_pair {|key, value| ... } ⇒ self @@ -315,7 +311,8 @@

    -
    +

    Iterates over each key value pair.

    +

  • @@ -323,7 +320,7 @@

  • - #each_value ⇒ undocumented + #each_value {|value| ... } ⇒ self @@ -337,7 +334,8 @@

    -
    +

    Iterates over each value.

    +

  • @@ -345,7 +343,7 @@

  • - #empty? ⇒ Boolean + #empty? ⇒ true, false @@ -359,7 +357,8 @@

    -
    +

    Is map empty?.

    +

  • @@ -367,7 +366,7 @@

  • - #fetch(key, default_value = NULL) ⇒ undocumented + #fetch(key, default_value = NULL) {|key| ... } ⇒ Object @@ -381,7 +380,7 @@

    -

    The "fetch-then-act" methods of Map are not atomic.

    +

    Get a value with key, or default_value when key is absent, or fail when no default_value is given.

  • @@ -390,7 +389,7 @@

  • - #fetch_or_store(key, default_value = NULL) ⇒ undocumented + #fetch_or_store(key, default_value = NULL) {|key| ... } ⇒ Object @@ -404,7 +403,7 @@

    -

    The "fetch-then-act" methods of Map are not atomic.

    +

    Fetch value with key, or store default value when key is absent, or fail when no default_value is given.

  • @@ -413,7 +412,7 @@

  • - #get_and_set ⇒ undocumented + #get_and_set(key, value) ⇒ Object? @@ -427,7 +426,7 @@

    -

    This method is atomic.

    +

    Get the current value under key and set new value.

  • @@ -461,7 +460,7 @@

  • - #key(value) ⇒ undocumented + #key(value) ⇒ Object? @@ -477,51 +476,8 @@

    -
    - -

  • - - -
  • - - - #keys ⇒ undocumented - - - - - - - - - - - - - -
    - -
  • - - -
  • - - - #marshal_dump ⇒ undocumented - - - - - - - - - - - - - -
    +

    Find key of a value.

    +
  • @@ -529,7 +485,7 @@

  • - #marshal_load(hash) ⇒ undocumented + #keys ⇒ ::Array<Object> @@ -543,7 +499,8 @@

    -
    +

    All keys.

    +

  • @@ -551,7 +508,7 @@

  • - #merge_pair ⇒ undocumented + #merge_pair(key, value) {|old_value| ... } ⇒ Object? @@ -565,7 +522,7 @@

    -

    This method is atomic.

    +

    If the key is absent, the value is stored, otherwise new value is computed with a block.

  • @@ -574,7 +531,7 @@

  • - #put_if_absent(key, value) ⇒ undocumented + #put_if_absent(key, value) ⇒ Object? @@ -588,7 +545,7 @@

    -

    This method is atomic.

    +

    Insert value into map with key if key is absent in one atomic step.

  • @@ -597,7 +554,7 @@

  • - #replace_if_exists ⇒ undocumented + #replace_if_exists(key, new_value) ⇒ Object? @@ -611,7 +568,7 @@

    -

    This method is atomic.

    +

    Replaces current value with new_value if key exists This method is atomic.

  • @@ -620,7 +577,7 @@

  • - #replace_pair ⇒ undocumented + #replace_pair(key, old_value, new_value) ⇒ true, false @@ -634,7 +591,7 @@

    -

    This method is atomic.

    +

    Replaces old_value with new_value if key exists and current value matches old_value This method is atomic.

  • @@ -643,7 +600,7 @@

  • - #size ⇒ undocumented + #size ⇒ Integer @@ -657,7 +614,8 @@

    -
    +

    The size of map.

    +

  • @@ -665,7 +623,7 @@

  • - #value?(value) ⇒ Boolean + #value?(value) ⇒ true, false @@ -679,7 +637,8 @@

    -
    +

    Is the value stored in the map.

    +

  • @@ -687,7 +646,7 @@

  • - #values ⇒ undocumented + #values ⇒ ::Array<Object> @@ -701,7 +660,8 @@

    -
    +

    All values.

    +

  • @@ -737,19 +697,19 @@

     
     
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    +118 +119 +120 +121 +122 +123 +124 +125 +126 +127

    -
    # File 'lib/concurrent/map.rb', line 75
    +      
    # File 'lib/concurrent/map.rb', line 118
     
     def initialize(options = nil, &block)
       if options.kind_of?(::Hash)
    @@ -776,7 +736,7 @@ 

    Instance Method Details

    - #[](key) ⇒ undocumented + #[](key) ⇒ Object @@ -786,28 +746,70 @@

    -

    +
    +
    +

    Get a value with key

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +

      the value

      +
      + +
    • + +
    + +
     
     
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144
    -
    # File 'lib/concurrent/map.rb', line 86
    +      
    # File 'lib/concurrent/map.rb', line 132
     
     def [](key)
       if value = super # non-falsy value is an existing mapping, return it right away
    @@ -830,7 +832,7 @@ 

    - #computeundocumented + #compute(key) {|old_value| ... } ⇒ Object? @@ -838,53 +840,107 @@

    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    + +
    + Note: +

    Atomic methods taking a block do not allow the self instance +to be used within the block. Doing so will cause a deadlock.

    +
    +
    + +

    Compute and store new value for key. +This method is atomic.

    +

    Parameters:

    +
      +
    • + + key + + + (Object) + + + +
    • + +
    -
    - - - - -
    -
    -
    -
    -
    -
    -
    # File 'lib/concurrent/map.rb', line 54
    -
    -
    -
    +

    Yields:

    +
      + +
    • + + + + + + + +

      compute new value from old one

      - -
      -

      + +

    • - #compute_if_absentundocumented +
    +

    Yield Parameters:

    +
      - +
    • + + old_value + + + (Object, nil) + + + + — +

      old_value, or nil when key is absent

      +
      + +
    • - +
    +

    Yield Returns:

    +
      -

    -
    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    - - -
    +
  • + + + (Object, nil) + + + + — +

    new value, when nil the key is removed

    -
    + +
  • + + +

    Returns:

    +
      + +
    • + + + (Object, nil) + + + + — +

      new value or nil

      +
      + +
    • +
    @@ -895,7 +951,7 @@

    @@ -904,9 +960,9 @@

    -

    +

    - #compute_if_presentundocumented + #compute_if_absent(key) { ... } ⇒ Object @@ -914,53 +970,88 @@

    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    + +
    + Note: +

    Atomic methods taking a block do not allow the self instance +to be used within the block. Doing so will cause a deadlock.

    +
    +
    + +

    Compute and store new value for key if the key is absent. +This method is atomic.

    +

    Parameters:

    +
      +
    • + + key + + + (Object) + + + +
    • + +
    -

    -
    # File 'lib/concurrent/map.rb', line 48
    +      
    # File 'lib/concurrent/map.rb', line 61
     
     
    - - - - -
    -
    -
    -
    -
    -
    -
    # File 'lib/concurrent/map.rb', line 51
    -
    -
    -
    +

    Yields:

    +
      + +
    • + + + + + + + +

      new value

      - -
      -

      + +

    • - #deleteundocumented +
    +

    Yield Returns:

    +
      - +
    • + + + (Object) + + + + — +

      new value

      +
      + +
    • - +
    +

    Returns:

    +
      -
      -
      -

      This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

      - - -
      +
    • + + + (Object) + + + + — +

      new value or current value

      -
      + +
    • +
    @@ -971,7 +1062,7 @@

    @@ -980,9 +1071,9 @@

    -

    +

    - #delete_pairundocumented + #compute_if_present(key) {|old_value| ... } ⇒ Object? @@ -990,15 +1081,547 @@

    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    + +
    + Note: +

    Atomic methods taking a block do not allow the self instance +to be used within the block. Doing so will cause a deadlock.

    +
    +
    + +

    Compute and store new value for key if the key is present. +This method is atomic.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    + +

    Yields:

    +
      + +
    • + + + + + + + +

      new value

      +
      + +
    • + +
    +

    Yield Parameters:

    +
      + +
    • + + old_value + + + (Object) + + + +
    • + +
    +

    Yield Returns:

    +
      + +
    • + + + (Object, nil) + + + + — +

      new value, when nil the key is removed

      +
      + +
    • + +
    +

    Returns:

    +
      + +
    • + + + (Object, nil) + + + + — +

      new value or nil

      +
      + +
    • + +
    + +

    -
    # File 'lib/concurrent/map.rb', line 69
    +      
    # File 'lib/concurrent/map.rb', line 44
     
     
    + + + + +
    +
    +
    +
    +
    +
    +
    # File 'lib/concurrent/map.rb', line 52
    +
    +
    +
    + + +
    +

    + + #delete(key) ⇒ Object? + + + + + +

    +
    +

    Delete key and its value. +This method is atomic.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object, nil) + + + + — +

      old value or nil when the key was absent

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +
    +
    +
    # File 'lib/concurrent/map.rb', line 104
    +
    +
    +
    +
    + +
    +

    + + #delete_pair(key, value) ⇒ true, false + + + + + +

    +
    +

    Delete pair and its value if current value equals the provided value. +This method is atomic.

    -
    +
    +

    Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    • + + value + + + (Object) + + + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (true, false) + + + + — +

      true if deleted

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +
    +
    +
    # File 'lib/concurrent/map.rb', line 110
    +
    +
    +
    +
    + +
    +

    + + #each_key {|key| ... } ⇒ self + + + + + +

    +
    + +
    + Note: +

    Atomic methods taking a block do not allow the self instance +to be used within the block. Doing so will cause a deadlock.

    +
    +
    + +

    Iterates over each key. +This method is atomic.

    + + +
    +
    +
    + +

    Yields:

    +
      + +
    • + + + + + + + +

      for each key in the map

      +
      + +
    • + +
    +

    Yield Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    +

    Returns:

    +
      + +
    • + + + (self) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +241
    +242
    +243
    +
    +
    # File 'lib/concurrent/map.rb', line 241
    +
    +def each_key
    +  each_pair {|k, v| yield k}
    +end
    +
    +
    + +
    +

    + + #each_pair {|key, value| ... } ⇒ self + + + + Also known as: + each + + + + +

    +
    + +
    + Note: +

    Atomic methods taking a block do not allow the self instance +to be used within the block. Doing so will cause a deadlock.

    +
    +
    + +

    Iterates over each key value pair. +This method is atomic.

    + + +
    +
    +
    + +

    Yields:

    +
      + +
    • + + + + + + + +

      for each key value pair in the map

      +
      + +
    • + +
    +

    Yield Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    • + + value + + + (Object) + + + +
    • + +
    +

    Returns:

    +
      + +
    • + + + (self) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +260
    +261
    +262
    +263
    +
    +
    # File 'lib/concurrent/map.rb', line 260
    +
    +def each_pair
    +  return enum_for :each_pair unless block_given?
    +  super
    +end
    +
    +
    + +
    +

    + + #each_value {|value| ... } ⇒ self + + + + + +

    +
    + +
    + Note: +

    Atomic methods taking a block do not allow the self instance +to be used within the block. Doing so will cause a deadlock.

    +
    +
    + +

    Iterates over each value. +This method is atomic.

    + + +
    +
    +
    + +

    Yields:

    +
      + +
    • + + + + + + + +

      for each value in the map

      +
      + +
    • + +
    +

    Yield Parameters:

    +
      + +
    • + + value + + + (Object) + + + +
    • +
    +

    Returns:

    +
      + +
    • + + + (self) + + + +
    • + +
    @@ -1006,29 +1629,15 @@

     
     
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    +250 +251 +252

    @@ -1036,29 +1645,54 @@

    -

    +

    - #each_keyundocumented + #empty?true, false + + +

    +
    +

    Is map empty?

    + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (true, false) + + + +
    • -

    -
    # File 'lib/concurrent/map.rb', line 75
    -
    -def initialize(options = nil, &block)
    -  if options.kind_of?(::Hash)
    -    validate_options_hash!(options)
    -  else
    -    options = nil
    -  end
    +      
    # File 'lib/concurrent/map.rb', line 250
     
    -  super(options)
    -  @default_proc = block
    +def each_value
    +  each_pair {|k, v| yield v}
     end
    + + +
    @@ -1066,19 +1700,151 @@

    -

    +

    - #each_pairundocumented + #fetch(key, default_value = NULL) {|key| ... } ⇒ Object - Also known as: - each - + + +

    +
    + +
    + Note: +

    The "fetch-then-act" methods of Map are not atomic. Map is intended +to be use as a concurrency primitive with strong happens-before +guarantees. It is not intended to be used as a high-level abstraction +supporting complex operations. All read and write operations are +thread safe, but no guarantees are made regarding race conditions +between the fetch operation and yielding to the block. Additionally, +this method does not support recursion. This is due to internal +constraints that are very unlikely to change in the near future.

    +
    +
    + +

    Get a value with key, or default_value when key is absent, +or fail when no default_value is given.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    • + + default_value + + + (Object) + + + (defaults to: NULL) + + +
    • +
    +

    Yields:

    +
      + +
    • + + + + + + + +

      default value for a key

      +
      + +
    • + +
    +

    Yield Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    +

    Yield Returns:

    +
      + +
    • + + + (Object) + + + + — +

      default value

      +
      + +
    • + +
    +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +

      the value or default value

      +
      + +
    • + +
    +

    Raises:

    +
      + +
    • + + + (KeyError) + + + + — +

      when key is missing and no default_value is provided

      +
      + +
    • -

     
     
    -160
    -161
    -162
    +278 +279 +280 +281
    -
    # File 'lib/concurrent/map.rb', line 160
    +      
    # File 'lib/concurrent/map.rb', line 278
     
    -def each_key
    -  each_pair {|k, v| yield k}
    +def empty?
    +  each_pair {|k, v| return false}
    +  true
     end
    + + +
    @@ -1087,44 +1853,178 @@ 

    168 169 170 -171

    +171 +172 +173 +174 +175 +176 +177 +178
    # File 'lib/concurrent/map.rb', line 168
     
    -def each_pair
    -  return enum_for :each_pair unless block_given?
    -  super
    +def fetch(key, default_value = NULL)
    +  if NULL != (value = get_or_default(key, NULL))
    +    value
    +  elsif block_given?
    +    yield key
    +  elsif NULL != default_value
    +    default_value
    +  else
    +    raise_fetch_no_key
    +  end
     end
    - -
    -

    + +
    +

    + + #fetch_or_store(key, default_value = NULL) {|key| ... } ⇒ Object + + + + + +

    +
    + +
    + Note: +

    Atomic methods taking a block do not allow the self instance +to be used within the block. Doing so will cause a deadlock.

    +
    +
    + +

    Fetch value with key, or store default value when key is absent, +or fail when no default_value is given. This is a two step operation, +therefore not atomic. The store can overwrite other concurrently +stored value. +This method is atomic.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    • + + default_value + + + (Object) + + + (defaults to: NULL) + + +
    • + +
    + +

    Yields:

    +
      + +
    • + + + + + + + +

      default value for a key

      +
      + +
    • + +
    +

    Yield Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    +

    Yield Returns:

    +
      + +
    • + + + (Object) + + + + — +

      default value

      +
      + +
    • - #each_valueundocumented +
    +

    Returns:

    +
      - +
    • + + + (Object) + + + + — +

      the value or default value

      +
      + +
    • +
    - -

    +
    @@ -1132,9 +2032,9 @@

    -

    +

    - #empty?Boolean + #get_and_set(key, value) ⇒ Object? @@ -1142,22 +2042,54 @@

    - +

    Get the current value under key and set new value. +This method is atomic.

    +
    +

    Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    • + + value + + + (Object) + + + +
    • +
    +

    Returns:

    • - (Boolean) + (Object, nil) + — +

      old value or nil when the key was absent

      +
      +
    @@ -1168,48 +2100,71 @@

     
     
    -181
    -182
    -183
    -184
    +

     
     
    -164
    -165
    -166
    +191 +192 +193 +194 +195
    -
    # File 'lib/concurrent/map.rb', line 164
    +      
    # File 'lib/concurrent/map.rb', line 191
     
    -def each_value
    -  each_pair {|k, v| yield v}
    +def fetch_or_store(key, default_value = NULL)
    +  fetch(key) do
    +    put(key, block_given? ? yield(key) : (NULL == default_value ? raise_fetch_no_key : default_value))
    +  end
     end
    -
    # File 'lib/concurrent/map.rb', line 181
    +      
    # File 'lib/concurrent/map.rb', line 97
     
    -def empty?
    -  each_pair {|k, v| return false}
    -  true
    -end
    +
    -

    +

    - #fetch(key, default_value = NULL) ⇒ undocumented + #key(value) ⇒ Object? + Also known as: + index + +

    -

    The "fetch-then-act" methods of Map are not atomic. Map is intended -to be use as a concurrency primitive with strong happens-before -guarantees. It is not intended to be used as a high-level abstraction -supporting complex operations. All read and write operations are -thread safe, but no guarantees are made regarding race conditions -between the fetch operation and yielding to the block. Additionally, -this method does not support recursion. This is due to internal -constraints that are very unlikely to change in the near future.

    +

    Find key of a value.

    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + +
    • +
    + +

    Returns:

    +
      + +
    • + + + (Object, nil) + + + + — +

      key or nil when not found

      +
      + +
    • + +
    @@ -1217,31 +2172,17 @@

     
     
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    +270 +271 +272 +273

    @@ -1249,9 +2190,9 @@

    -

    +

    - #fetch_or_store(key, default_value = NULL) ⇒ undocumented + #keys::Array<Object> @@ -1259,20 +2200,30 @@

    -

    The "fetch-then-act" methods of Map are not atomic. Map is intended -to be use as a concurrency primitive with strong happens-before -guarantees. It is not intended to be used as a high-level abstraction -supporting complex operations. All read and write operations are -thread safe, but no guarantees are made regarding race conditions -between the fetch operation and yielding to the block. Additionally, -this method does not support recursion. This is due to internal -constraints that are very unlikely to change in the near future.

    +

    All keys

    +

    Returns:

    +
      + +
    • + + + (::Array<Object>) + + + + — +

      keys

      +
      + +
    • + +

    -
    # File 'lib/concurrent/map.rb', line 112
    +      
    # File 'lib/concurrent/map.rb', line 270
     
    -def fetch(key, default_value = NULL)
    -  if NULL != (value = get_or_default(key, NULL))
    -    value
    -  elsif block_given?
    -    yield key
    -  elsif NULL != default_value
    -    default_value
    -  else
    -    raise_fetch_no_key
    -  end
    +def key(value)
    +  each_pair {|k, v| return k if v == value}
    +  nil
     end
    @@ -1280,19 +2231,19 @@

     
     
    -125
    -126
    -127
    -128
    -129
    +222 +223 +224 +225 +226

    @@ -1300,9 +2251,9 @@

    -

    +

    - #get_and_setundocumented + #merge_pair(key, value) {|old_value| ... } ⇒ Object? @@ -1310,107 +2261,141 @@

    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    + +
    + Note: +

    Atomic methods taking a block do not allow the self instance +to be used within the block. Doing so will cause a deadlock.

    +
    +
    + +

    If the key is absent, the value is stored, otherwise new value is +computed with a block. +This method is atomic.

    +

    Parameters:

    +
      - -

    -
    # File 'lib/concurrent/map.rb', line 125
    +      
    # File 'lib/concurrent/map.rb', line 222
     
    -def fetch_or_store(key, default_value = NULL)
    -  fetch(key) do
    -    put(key, block_given? ? yield(key) : (NULL == default_value ? raise_fetch_no_key : default_value))
    -  end
    +def keys
    +  arr = []
    +  each_pair {|k, v| arr << k}
    +  arr
     end
    - - - - -
    -
    -
    -
    -
    -
    -
    # File 'lib/concurrent/map.rb', line 66
    -
    -
    -
    -
    - -
    -

    +
  • + + key + + + (Object) + + + +
  • - #key(value) ⇒ undocumented +
  • + + value + + + (Object) + + + +
  • + +

    Yields:

    +
      - Also known as: - index - +
    • + + + + + + + +

      compute new value from old one

      +
      + +
    • - +
    +

    Yield Parameters:

    +
      -

    - - - - -
    -
    -
    -
    -175
    -176
    -177
    -178
    -
    -
    # File 'lib/concurrent/map.rb', line 175
    -
    -def key(value)
    -  each_pair {|k, v| return k if v == value}
    -  nil
    -end
    -
    +
  • + + old_value + + + (Object) + + + + — +

    old value

    +
    + +
  • + + +

    Yield Returns:

    +
      + +
    • + + + (Object, nil) + + + + — +

      new value, when nil the key is removed

      - -
      -

      + +

    • - #keysundocumented +
    +

    Returns:

    +
      - +
    • + + + (Object, nil) + + + + — +

      new value or nil

      +
      + +
    • +
    - - +
     
     
    -148
    -149
    -150
    -151
    -152
    +
    -
    # File 'lib/concurrent/map.rb', line 148
    +      
    # File 'lib/concurrent/map.rb', line 70
     
    -def keys
    -  arr = []
    -  each_pair {|k, v| arr << k}
    -  arr
    -end
    +
    -

    +

    - #marshal_dumpundocumented + #put_if_absent(key, value) ⇒ Object? @@ -1418,19 +2403,32 @@

    - +

    Insert value into map with key if key is absent in one atomic step.

    +
    +

    Parameters:

    +
      -

      Raises:

      -
        +
      • + + key + + + (Object) + + + +
      • + value + - (TypeError) + (Object) @@ -1438,59 +2436,49 @@

      -
    - - - - -
    -
    -
    -
    -192
    -193
    -194
    -195
    -196
    -197
    -
    -
    # File 'lib/concurrent/map.rb', line 192
    -
    -def marshal_dump
    -  raise TypeError, "can't dump hash with default proc" if @default_proc
    -  h = {}
    -  each_pair {|k, v| h[k] = v}
    -  h
    -end
    -
    -
    - -
    -

    - - #marshal_load(hash) ⇒ undocumented +

    Returns:

    +
      - +
    • + + + (Object, nil) + + + + — +

      the value or nil when key was present

      +
      + +
    • +
    - -

    +
    @@ -1498,9 +2486,9 @@

    -

    +

    - #merge_pairundocumented + #replace_if_exists(key, new_value) ⇒ Object? @@ -1508,15 +2496,57 @@

    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    +

    Replaces current value with new_value if key exists +This method is atomic.

    +

    Parameters:

    +
      + +
    • + + key + + + (Object) + + + +
    • + +
    • + + new_value + + + (Object) + + + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object, nil) + + + + — +

      old value or nil

      +
      + +
    • +

     
     
    -199
    -200
     201
    -202
    +202 +203 +204 +205 +206 +207 +208
    -
    # File 'lib/concurrent/map.rb', line 199
    +      
    # File 'lib/concurrent/map.rb', line 201
     
    -def marshal_load(hash)
    -  initialize
    -  populate_from(hash)
    +def put_if_absent(key, value)
    +  computed = false
    +  result = compute_if_absent(key) do
    +    computed = true
    +    value
    +  end
    +  computed ? nil : result
     end
    @@ -1527,7 +2557,7 @@

    @@ -1536,9 +2566,9 @@

    -

    +

    - #put_if_absent(key, value) ⇒ undocumented + #replace_pair(key, old_value, new_value) ⇒ true, false @@ -1546,53 +2576,69 @@

    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    +

    Replaces old_value with new_value if key exists and current value +matches old_value +This method is atomic.

    +

    Parameters:

    +
      - -

    -
    # File 'lib/concurrent/map.rb', line 57
    +      
    # File 'lib/concurrent/map.rb', line 90
     
     
    - - - - -
    -
    -
    -
    -
    -
    -
    # File 'lib/concurrent/map.rb', line 45
    -
    -
    -
    -
    - -
    -

    +
  • + + key + + + (Object) + + + +
  • - #replace_if_existsundocumented +
  • + + old_value + + + (Object) + + + +
  • - +
  • + + new_value + + + (Object) + + + +
  • + +

    Returns:

    +
      -

    -
    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    - - -
    +
  • + + + (true, false) + + + + — +

    true if replaced

    -
    + +
  • +
    @@ -1603,7 +2649,7 @@

    @@ -1612,9 +2658,9 @@

    -

    +

    - #replace_pairundocumented + #sizeInteger @@ -1622,56 +2668,45 @@

    -

    This method is atomic. Atomic methods of Map which accept a block -do not allow the self instance to be used within the block. Doing -so will cause a deadlock.

    +

    The size of map.

    - -

    -
    # File 'lib/concurrent/map.rb', line 63
    +      
    # File 'lib/concurrent/map.rb', line 81
     
     
    - - - - -
    -
    -
    -
    -
    -
    -
    # File 'lib/concurrent/map.rb', line 60
    -
    -
    -
    -
    - -
    -

    - - #sizeundocumented +

    Returns:

    +
      - +
    • + + + (Integer) + + + + — +

      size

      +
      + +
    • +
    - -

    +
     
     
    -186
    -187
    -188
    -189
    -190
    +285 +286 +287 +288 +289
    -
    # File 'lib/concurrent/map.rb', line 186
    +      
    # File 'lib/concurrent/map.rb', line 285
     
     def size
       count = 0
    @@ -1686,7 +2721,7 @@ 

    - #value?(value) ⇒ Boolean + #value?(value) ⇒ true, false @@ -1694,19 +2729,35 @@

    - +

    Is the value stored in the map. Iterates over all values.

    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + +
    • +
    +

    Returns:

    • - (Boolean) + (true, false) @@ -1720,15 +2771,15 @@

       
       
      -141
      -142
      -143
      -144
      -145
      -146
      +213 +214 +215 +216 +217 +218

    -
    # File 'lib/concurrent/map.rb', line 141
    +      
    # File 'lib/concurrent/map.rb', line 213
     
     def value?(value)
       each_value do |v|
    @@ -1744,26 +2795,53 @@ 

    - #valuesundocumented + #values::Array<Object> -

    +
    +
    +

    All values

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (::Array<Object>) + + + + — +

      values

      +
      + +
    • + +
    + +
     
     
    -154
    -155
    -156
    -157
    -158
    +230 +231 +232 +233 +234
    -
    # File 'lib/concurrent/map.rb', line 154
    +      
    # File 'lib/concurrent/map.rb', line 230
     
     def values
       arr = []
    diff --git a/docs/master/file.CHANGELOG.html b/docs/master/file.CHANGELOG.html
    index bfa783594..fb9d95e4d 100644
    --- a/docs/master/file.CHANGELOG.html
    +++ b/docs/master/file.CHANGELOG.html
    @@ -59,6 +59,22 @@
     
           

    Current

    +

    Release v1.1.0.pre2, edge v0.4.0.pre2 (18 Sep 2018)

    + +

    concurrent-ruby:

    + +
      +
    • fixed documentation and README links
    • +
    • fix Set for TruffleRuby and Rubinius
    • +
    • use properly supported TruffleRuby APIs
    • +
    + +

    concurrent-ruby-edge:

    + +
      +
    • add Promises.zip_futures_over_on
    • +
    +

    Release v1.1.0.pre1, edge v0.4.0.pre1 (15 Aug 2018)

    concurrent-ruby:

    diff --git a/docs/master/method_list.html b/docs/master/method_list.html index f7b73208b..fca3a94af 100644 --- a/docs/master/method_list.html +++ b/docs/master/method_list.html @@ -46,32 +46,32 @@

    Method List

  • - #<< - Concurrent::Edge::LockFreeLinkedSet + #<< + Concurrent::ImmediateExecutor
  • - #<< - Concurrent::Agent + << + Concurrent::SimpleExecutorService
  • - #<< - Concurrent::ImmediateExecutor + #<< + Concurrent::SimpleExecutorService
  • - #<< - Concurrent::ThreadPoolExecutor + #<< + Concurrent::Agent
  • @@ -86,24 +86,24 @@

    Method List

  • - #<< - Concurrent::SimpleExecutorService + #<< + Concurrent::Edge::LockFreeLinkedSet
  • - << - Concurrent::SimpleExecutorService + #<< + Concurrent::ThreadPoolExecutor
  • - #<=> - Concurrent::Edge::LockFreeLinkedSet::Head + #<=> + Concurrent::Edge::LockFreeLinkedSet::Tail
  • @@ -118,24 +118,24 @@

    Method List

  • - #<=> - Concurrent::Edge::LockFreeLinkedSet::Tail + #<=> + Concurrent::Channel::Tick
  • - #<=> - Concurrent::Channel::Tick + #<=> + Concurrent::Edge::LockFreeLinkedSet::Node
  • - #<=> - Concurrent::Edge::LockFreeLinkedSet::Node + #<=> + Concurrent::Edge::LockFreeLinkedSet::Head
  • @@ -150,24 +150,24 @@

    Method List

  • - #== - Concurrent::Actor::Reference + #== + Concurrent::MutableStruct
  • - #== - Concurrent::MutableStruct + #== + Concurrent::SettableStruct
  • - #== - Concurrent::SettableStruct + #== + Concurrent::Actor::Reference
  • @@ -230,16 +230,16 @@

    Method List

  • - #[] - Concurrent::LazyRegister + #[] + Concurrent::ImmutableStruct
  • - #[] - Concurrent::SettableStruct + #[] + Concurrent::LazyRegister
  • @@ -254,24 +254,24 @@

    Method List

  • - #[] - Concurrent::ImmutableStruct + #[] + Concurrent::SettableStruct
  • - #[]= - Concurrent::MutableStruct + #[]= + Concurrent::SettableStruct
  • - #[]= - Concurrent::SettableStruct + #[]= + Concurrent::MutableStruct
  • @@ -302,16 +302,16 @@

    Method List

  • - #acquire_read_lock - Concurrent::ReentrantReadWriteLock + #acquire_read_lock + Concurrent::ReadWriteLock
  • - #acquire_read_lock - Concurrent::ReadWriteLock + #acquire_read_lock + Concurrent::ReentrantReadWriteLock
  • @@ -382,16 +382,16 @@

    Method List

  • - #add_observer - Concurrent::Collection::CopyOnNotifyObserverSet + #add_observer + Concurrent::IVar
  • - #add_observer - Concurrent::IVar + #add_observer + Concurrent::Collection::CopyOnNotifyObserverSet
  • @@ -438,16 +438,16 @@

    Method List

  • - #any - Concurrent::Promises::Event + #any + Concurrent::Promises::Future
  • - #any - Concurrent::Promises::Future + #any + Concurrent::Promises::Event
  • @@ -518,24 +518,24 @@

    Method List

  • - #ask - Concurrent::ProcessingActor + #ask + Concurrent::Actor::AbstractContext
  • - #ask - Concurrent::Actor::AbstractContext + #ask + Concurrent::Actor::Reference
  • - #ask - Concurrent::Actor::Reference + #ask + Concurrent::ProcessingActor
  • @@ -574,16 +574,16 @@

    Method List

  • - attr_volatile - Concurrent::Synchronization::Object + #attr_volatile + Concurrent::Synchronization::JRubyAttrVolatile::ClassMethods
  • - #attr_volatile - Concurrent::Synchronization::JRubyAttrVolatile::ClassMethods + attr_volatile + Concurrent::Synchronization::Object
  • @@ -598,32 +598,32 @@

    Method List

  • - #attr_volatile - Concurrent::Synchronization::RbxAttrVolatile::ClassMethods + #attr_volatile + Concurrent::Synchronization::MriAttrVolatile::ClassMethods
  • - #attr_volatile - Concurrent::Synchronization::MriAttrVolatile::ClassMethods + #attr_volatile + Concurrent::Synchronization::RbxAttrVolatile::ClassMethods
  • - #auto_terminate= - Concurrent::ThreadPoolExecutor + #auto_terminate= + Concurrent::SingleThreadExecutor
  • - #auto_terminate= - Concurrent::SingleThreadExecutor + #auto_terminate= + Concurrent::ThreadPoolExecutor
  • @@ -654,8 +654,8 @@

    Method List

  • - #await - Concurrent::Agent + #await + Concurrent::Async
  • @@ -670,8 +670,8 @@

    Method List

  • - #await - Concurrent::Async + #await + Concurrent::Agent
  • @@ -726,16 +726,16 @@

    Method List

  • - #behaviour - Concurrent::Actor::InternalDelegations + #behaviour + Concurrent::Actor::Core
  • - #behaviour - Concurrent::Actor::Core + #behaviour + Concurrent::Actor::InternalDelegations
  • @@ -758,24 +758,24 @@

    Method List

  • - #behaviour_definition - Concurrent::Actor::Context + #behaviour_definition + Concurrent::Actor::RestartingContext
  • - #behaviour_definition - Concurrent::Actor::Core + #behaviour_definition + Concurrent::Actor::Root
  • - #behaviour_definition - Concurrent::Actor::Root + #behaviour_definition + Concurrent::Actor::Core
  • @@ -790,8 +790,8 @@

    Method List

  • - #behaviour_definition - Concurrent::Actor::RestartingContext + #behaviour_definition + Concurrent::Actor::Context
  • @@ -814,8 +814,8 @@

    Method List

  • - #blocking? - Concurrent::Channel::Buffer::Sliding + #blocking? + Concurrent::Channel::Buffer::Base
  • @@ -830,8 +830,8 @@

    Method List

  • - #blocking? - Concurrent::Channel::Buffer::Base + #blocking? + Concurrent::Channel::Buffer::Sliding
  • @@ -846,8 +846,8 @@

    Method List

  • - #broadcast - Concurrent::Synchronization::Condition + #broadcast + Concurrent::Synchronization::Lock
  • @@ -862,16 +862,16 @@

    Method List

  • - #broadcast - Concurrent::Actor::Behaviour::Abstract + #broadcast + Concurrent::Synchronization::Condition
  • - #broadcast - Concurrent::Synchronization::Lock + #broadcast + Concurrent::Actor::Behaviour::Abstract
  • @@ -910,56 +910,56 @@

    Method List

  • - #can_overflow? - Concurrent::ThreadPoolExecutor + #can_overflow? + Concurrent::SingleThreadExecutor
  • - #can_overflow? - Concurrent::SingleThreadExecutor + #can_overflow? + Concurrent::ThreadPoolExecutor
  • - #cancel - Concurrent::Cancellation + #cancel + Concurrent::ScheduledTask
  • - #cancel - Concurrent::Future + #cancel + Concurrent::Cancellation
  • - #cancel - Concurrent::ScheduledTask + #cancel + Concurrent::Future
  • - #canceled? - Concurrent::Cancellation::Token + #canceled? + Concurrent::Cancellation
  • - #canceled? - Concurrent::Cancellation + #canceled? + Concurrent::Cancellation::Token
  • @@ -1110,8 +1110,8 @@

    Method List

  • - #compare_and_set - Concurrent::Tuple + #compare_and_set + Concurrent::Atom
  • @@ -1126,16 +1126,16 @@

    Method List

  • - #compare_and_set - Concurrent::Atom + #compare_and_set + Concurrent::AtomicReference
  • - #compare_and_set - Concurrent::AtomicReference + #compare_and_set + Concurrent::Tuple
  • @@ -1198,48 +1198,48 @@

    Method List

  • - #context - Concurrent::Actor::InternalDelegations + #context + Concurrent::Actor::Core
  • - #context - Concurrent::Actor::Core + #context + Concurrent::Actor::InternalDelegations
  • - #context_class - Concurrent::Actor::Core + #context_class + Concurrent::Actor::PublicDelegations
  • - #context_class - Concurrent::Actor::PublicDelegations + #context_class + Concurrent::Actor::Core
  • - #core - Concurrent::Actor::Behaviour::Abstract + #core + Concurrent::Actor::AbstractContext
  • - #core - Concurrent::Actor::AbstractContext + #core + Concurrent::Actor::Behaviour::Abstract
  • @@ -1262,24 +1262,24 @@

    Method List

  • - #count_observers - Concurrent::Collection::CopyOnWriteObserverSet + #count_observers + Concurrent::Concern::Observable
  • - #count_observers - Concurrent::Concern::Observable + #count_observers + Concurrent::Collection::CopyOnNotifyObserverSet
  • - #count_observers - Concurrent::Collection::CopyOnNotifyObserverSet + #count_observers + Concurrent::Collection::CopyOnWriteObserverSet
  • @@ -1318,16 +1318,16 @@

    Method List

  • - current - Concurrent::Transaction + current + Concurrent::Actor
  • - current - Concurrent::Actor + current + Concurrent::Transaction
  • @@ -1382,40 +1382,40 @@

    Method List

  • - #dead_letter_routing - Concurrent::Actor::AbstractContext + #dead_letter_routing + Concurrent::Actor::Root
  • - #dead_letter_routing - Concurrent::Actor::Reference + #dead_letter_routing + Concurrent::Actor::InternalDelegations
  • - #dead_letter_routing - Concurrent::Actor::Root + #dead_letter_routing + Concurrent::Actor::Reference
  • - #dead_letter_routing - Concurrent::Actor::Core + #dead_letter_routing + Concurrent::Actor::AbstractContext
  • - #dead_letter_routing - Concurrent::Actor::InternalDelegations + #dead_letter_routing + Concurrent::Actor::Core
  • @@ -1438,16 +1438,16 @@

    Method List

  • - #default_executor - Concurrent::Promises::FactoryMethods::Configuration + #default_executor + Concurrent::Actor::AbstractContext
  • - #default_executor - Concurrent::Actor::AbstractContext + #default_executor + Concurrent::Promises::FactoryMethods::Configuration
  • @@ -1462,8 +1462,8 @@

    Method List

  • - #delay - Concurrent::Promises::Future + #delay + Concurrent::Promises::FactoryMethods
  • @@ -1478,8 +1478,8 @@

    Method List

  • - #delay - Concurrent::Promises::FactoryMethods + #delay + Concurrent::Promises::Future
  • @@ -1502,48 +1502,48 @@

    Method List

  • - #delete_observer - Concurrent::Collection::CopyOnWriteObserverSet + #delete_observer + Concurrent::Collection::CopyOnNotifyObserverSet
  • - #delete_observer - Concurrent::Collection::CopyOnNotifyObserverSet + #delete_observer + Concurrent::Concern::Observable
  • - #delete_observer - Concurrent::Concern::Observable + #delete_observer + Concurrent::Collection::CopyOnWriteObserverSet
  • - #delete_observers - Concurrent::Collection::CopyOnWriteObserverSet + #delete_observers + Concurrent::Collection::CopyOnNotifyObserverSet
  • - #delete_observers - Concurrent::Collection::CopyOnNotifyObserverSet + #delete_observers + Concurrent::Concern::Observable
  • - #delete_observers - Concurrent::Concern::Observable + #delete_observers + Concurrent::Collection::CopyOnWriteObserverSet
  • @@ -1590,48 +1590,48 @@

    Method List

  • - #each - Concurrent::Edge::LockFreeLinkedSet + #each + Concurrent::Channel
  • - #each - Concurrent::Tuple + #each + Concurrent::MutableStruct
  • - #each - Concurrent::Channel + #each + Concurrent::LockFreeStack
  • - #each - Concurrent::MutableStruct + #each + Concurrent::ImmutableStruct
  • - #each - Concurrent::ImmutableStruct + #each + Concurrent::Tuple
  • - #each - Concurrent::LockFreeStack + #each + Concurrent::Edge::LockFreeLinkedSet
  • @@ -1646,32 +1646,32 @@

    Method List

  • - #each_pair - Concurrent::MutableStruct + #each_pair + Concurrent::ImmutableStruct
  • - #each_pair - Concurrent::ImmutableStruct + #each_pair + Concurrent::SettableStruct
  • - #each_pair - Concurrent::SettableStruct + #each_pair + Concurrent::Map
  • - #each_pair - Concurrent::Map + #each_pair + Concurrent::MutableStruct
  • @@ -1694,32 +1694,32 @@

    Method List

  • - #empty? - Concurrent::Channel::Buffer::Unbuffered + #empty? + Concurrent::Map
  • - #empty? - Concurrent::Channel::Buffer::Base + #empty? + Concurrent::MVar
  • - #empty? - Concurrent::Map + #empty? + Concurrent::Channel::Buffer::Base
  • - #empty? - Concurrent::MVar + #empty? + Concurrent::Channel::Buffer::Unbuffered
  • @@ -1734,16 +1734,16 @@

    Method List

  • - #envelope - Concurrent::Actor::AbstractContext + #envelope + Concurrent::Actor::UnknownMessage
  • - #envelope - Concurrent::Actor::UnknownMessage + #envelope + Concurrent::Actor::AbstractContext
  • @@ -1838,31 +1838,31 @@

    Method List

  • - execute - Concurrent::TimerTask + #execute + Concurrent::Channel::Selector::PutClause
  • - #execute - Concurrent::Future + #execute + Concurrent::TimerTask
  • - execute - Concurrent::Future + execute + Concurrent::TimerTask
  • - #execute + execute Concurrent::Promise
  • @@ -1870,48 +1870,48 @@

    Method List

  • - execute - Concurrent::Promise + #execute + Concurrent::ScheduledTask
  • - #execute - Concurrent::TimerTask + execute + Concurrent::ScheduledTask
  • - #execute - Concurrent::ScheduledTask + #execute + Concurrent::Promise
  • - execute - Concurrent::ScheduledTask + execute + Concurrent::Future
  • - #execute - Concurrent::Channel::Selector::DefaultClause + #execute + Concurrent::Future
  • - #execute - Concurrent::Channel::Selector::ErrorClause + #execute + Concurrent::Channel::Selector::TakeClause
  • @@ -1926,24 +1926,24 @@

    Method List

  • - #execute - Concurrent::SafeTaskExecutor + #execute + Concurrent::Channel::Selector::ErrorClause
  • - #execute - Concurrent::Channel::Selector::TakeClause + #execute + Concurrent::Channel::Selector::DefaultClause
  • - #execute - Concurrent::Channel::Selector::PutClause + #execute + Concurrent::SafeTaskExecutor
  • @@ -1966,16 +1966,16 @@

    Method List

  • - #executor - Concurrent::Actor::PublicDelegations + #executor + Concurrent::SerializedExecution::Job
  • - #executor - Concurrent::SerializedExecution::Job + #executor + Concurrent::Actor::PublicDelegations
  • @@ -2014,16 +2014,16 @@

    Method List

  • - #fallback_policy - Concurrent::SingleThreadExecutor + #fallback_policy + Concurrent::ThreadPoolExecutor
  • - #fallback_policy - Concurrent::ThreadPoolExecutor + #fallback_policy + Concurrent::SingleThreadExecutor
  • @@ -2142,80 +2142,80 @@

    Method List

  • - #full? - Concurrent::Channel::Buffer::Base + #full? + Concurrent::MVar
  • - #full? - Concurrent::MVar + #full? + Concurrent::Channel::Buffer::Dropping
  • - #full? - Concurrent::Channel::Buffer::Dropping + #full? + Concurrent::Channel::Buffer::Base
  • - #full? - Concurrent::Channel::Buffer::Unbuffered + #full? + Concurrent::Channel::Buffer::Sliding
  • - #full? - Concurrent::Channel::Buffer::Sliding + #full? + Concurrent::Channel::Buffer::Unbuffered
  • - #full_memory_barrier - Concurrent::Synchronization::MriAttrVolatile + #full_memory_barrier + Concurrent::Synchronization::TruffleRubyAttrVolatile
  • - #full_memory_barrier - Concurrent::Synchronization::RbxAttrVolatile + #full_memory_barrier + Concurrent::Synchronization::MriAttrVolatile
  • - #full_memory_barrier - Concurrent::Synchronization::TruffleRubyAttrVolatile + #full_memory_barrier + Concurrent::Synchronization::RbxAttrVolatile
  • - #future - Concurrent::Promises::FactoryMethods + #future + Concurrent::Actor::Envelope
  • - #future - Concurrent::Actor::Envelope + #future + Concurrent::Promises::FactoryMethods
  • @@ -2230,24 +2230,24 @@

    Method List

  • - #get - Concurrent::Tuple + #get + Concurrent::AtomicMarkableReference
  • - #get - Concurrent::AtomicReference + #get + Concurrent::Tuple
  • - #get - Concurrent::AtomicMarkableReference + #get + Concurrent::AtomicReference
  • @@ -2406,632 +2406,632 @@

    Method List

  • - #initialize - Concurrent::Agent + #initialize + Concurrent::Synchronization::Condition
  • - #initialize - Concurrent::Actor::Envelope + #initialize + Concurrent::Channel::Tick
  • - #initialize - Concurrent::ScheduledTask + #initialize + Concurrent::TimerTask
  • - #initialize - Concurrent::Throttle + #initialize + Concurrent::Actor::UnknownMessage
  • - #initialize - Concurrent::Edge::LockFreeLinkedSet + #initialize + Concurrent::Actor::ActorTerminated
  • - #initialize - Concurrent::TimerSet + #initialize + Concurrent::ThreadPoolExecutor
  • - #initialize - Concurrent::AtomicFixnum + #initialize + Concurrent::Actor::Root
  • - #initialize - Concurrent::LockFreeStack + #initialize + Concurrent::TVar
  • - #initialize - Concurrent::Event + #initialize + Concurrent::LockFreeStack::Node
  • - #initialize - Concurrent::Actor::Behaviour::Supervising + #initialize + Concurrent::FixedThreadPool
  • - #initialize - Concurrent::Edge::LockFreeLinkedSet::Window + #initialize + Concurrent::CachedThreadPool
  • - #initialize - Concurrent::TimerTask + #initialize + Concurrent::ImmediateExecutor
  • - #initialize - Concurrent::Exchanger + #initialize + Concurrent::MVar
  • - #initialize - Concurrent::AtomicBoolean + #initialize + Concurrent::IVar
  • - #initialize - Concurrent::Promises::Channel + #initialize + Concurrent::SafeTaskExecutor
  • - #initialize - Concurrent::Actor::Utils::Pool + #initialize + Concurrent::SerializedExecution
  • - #initialize - Concurrent::CyclicBarrier + #initialize + Concurrent::Actor::Behaviour::Linking
  • - #initialize - Concurrent::SerializedExecutionDelegator + #initialize + Concurrent::Atom
  • - #initialize - Concurrent::ReadWriteLock + #initialize + Concurrent::Actor::Behaviour::Pausing
  • - #initialize - Concurrent::Channel::Selector::DefaultClause + #initialize + Concurrent::Actor::Core
  • - #initialize - Concurrent::Actor::Utils::AsAdHoc + #initialize + Concurrent::Event
  • - #initialize - Concurrent::Synchronization::Object + #initialize + Concurrent::Agent::Error
  • - #initialize - Concurrent::Channel::Buffer::Base + #initialize + Concurrent::Actor::Utils::AsAdHoc
  • - #initialize - Concurrent::Promise + #initialize + Concurrent::Channel::Buffer::Base
  • - #initialize - Concurrent::Edge::LockFreeLinkedSet::Tail + #initialize + Concurrent::Semaphore
  • - #initialize - Concurrent::AtomicReference + #initialize + Concurrent::Future
  • - #initialize - Concurrent::Future + #initialize + Concurrent::MultipleAssignmentError
  • - #initialize - Concurrent::MultipleErrors + #initialize + Concurrent::Channel::Selector::TakeClause
  • - #initialize - Concurrent::CountDownLatch + #initialize + Concurrent::MultipleErrors
  • - #initialize - Concurrent::MultipleAssignmentError + #initialize + Concurrent::Actor::Utils::Pool
  • - #initialize - Concurrent::ThreadLocalVar + #initialize + Concurrent::ReentrantReadWriteLock
  • - #initialize - Concurrent::Tuple + #initialize + Concurrent::Actor::Utils::Balancer
  • - #initialize - Concurrent::Edge::LockFreeLinkedSet::Node + #initialize + Concurrent::Tuple
  • - #initialize - Concurrent::Synchronization::Condition + #initialize + Concurrent::Channel::Selector::AfterClause
  • - #initialize - Concurrent::Channel::Selector::ErrorClause + #initialize + Concurrent::LockFreeQueue::Node
  • - #initialize - Concurrent::LockFreeStack::Node + #initialize + Concurrent::Collection::CopyOnWriteObserverSet
  • - #initialize - Concurrent::FixedThreadPool + #initialize + Concurrent::TimerSet
  • - #initialize - Concurrent::CachedThreadPool + #initialize + Concurrent::Channel::Selector::ErrorClause
  • - #initialize - Concurrent::ImmediateExecutor + #initialize + Concurrent::AtomicFixnum
  • - #initialize - Concurrent::Actor::Utils::Balancer + #initialize + Concurrent::Collection::CopyOnNotifyObserverSet
  • - #initialize - Concurrent::Delay + #initialize + Concurrent::IndirectImmediateExecutor
  • - #initialize - Concurrent::Channel::Tick + #initialize + Concurrent::Actor::Utils::Broadcast
  • - #initialize - Concurrent::Channel::Selector::AfterClause + #initialize + Concurrent::Edge::LockFreeLinkedSet::Node
  • - #initialize - Concurrent::SafeTaskExecutor + #initialize + Concurrent::AtomicBoolean
  • - #initialize - Concurrent::Channel + #initialize + Concurrent::AtomicMarkableReference
  • - #initialize - Concurrent::SerializedExecution + #initialize + Concurrent::SingleThreadExecutor
  • - #initialize - Concurrent::Actor::UnknownMessage + #initialize + Concurrent::Map
  • - #initialize - Concurrent::LockFreeQueue::Node + #initialize + Concurrent::Exchanger
  • - #initialize - Concurrent::Actor::Utils::Broadcast + #initialize + Concurrent::CyclicBarrier
  • - #initialize - Concurrent::Actor::ActorTerminated + #initialize + Concurrent::SerializedExecutionDelegator
  • - #initialize - Concurrent::Actor::Root + #initialize + Concurrent::Actor::Envelope
  • - #initialize - Concurrent::Agent::ValidationError + #initialize + Concurrent::Delay
  • - #initialize - Concurrent::Agent::Error + #initialize + Concurrent::ReadWriteLock
  • - #initialize - Concurrent::Transaction + #initialize + Concurrent::Channel::ValidationError
  • - #initialize - Concurrent::Actor::Behaviour::Buffer + #initialize + Concurrent::Edge::LockFreeLinkedSet::Tail
  • - #initialize - Concurrent::ThreadPoolExecutor + #initialize + Concurrent::Channel::Selector::DefaultClause
  • - #initialize - Concurrent::TVar + #initialize + Concurrent::LazyRegister
  • - #initialize - Concurrent::Channel::ValidationError + #initialize + Concurrent::Edge::LockFreeLinkedSet
  • - #initialize - Concurrent::Actor::Behaviour::Linking + #initialize + Concurrent::Edge::LockFreeLinkedSet::Window
  • - #initialize - Concurrent::SingleThreadExecutor + #initialize + Concurrent::Synchronization::Object
  • - #initialize - Concurrent::AtomicMarkableReference + #initialize + Concurrent::Throttle
  • - #initialize - Concurrent::Actor::Behaviour::Pausing + #initialize + Concurrent::ScheduledTask
  • - #initialize - Concurrent::Channel::Selector::TakeClause + #initialize + Concurrent::Promises::Channel
  • - #initialize - Concurrent::Actor::Core + #initialize + Concurrent::Channel::Selector::PutClause
  • - #initialize - Concurrent::Actor::Behaviour::SetResults + #initialize + Concurrent::Actor::Behaviour::Termination
  • - #initialize - Concurrent::MVar + #initialize + Concurrent::Channel
  • - #initialize - Concurrent::ReentrantReadWriteLock + #initialize + Concurrent::AtomicReference
  • - #initialize - Concurrent::Channel::Selector::PutClause + #initialize + Concurrent::Agent
  • - #initialize - Concurrent::IVar + #initialize + Concurrent::Agent::ValidationError
  • - #initialize - Concurrent::Actor::Behaviour::Abstract + #initialize + Concurrent::Actor::Behaviour::Supervising
  • - #initialize - Concurrent::Atom + #initialize + Concurrent::CountDownLatch
  • - #initialize - Concurrent::Actor::Behaviour::Termination + #initialize + Concurrent::Actor::Behaviour::Abstract
  • - #initialize - Concurrent::IndirectImmediateExecutor + #initialize + Concurrent::Actor::Behaviour::SetResults
  • - #initialize - Concurrent::Collection::CopyOnWriteObserverSet + #initialize + Concurrent::Promise
  • - #initialize - Concurrent::Collection::CopyOnNotifyObserverSet + #initialize + Concurrent::ThreadLocalVar
  • - #initialize - Concurrent::Map + #initialize + Concurrent::Actor::Behaviour::Buffer
  • - #initialize - Concurrent::Semaphore + #initialize + Concurrent::LockFreeStack
  • - #initialize - Concurrent::LazyRegister + #initialize + Concurrent::Transaction
  • - #inspect - Concurrent::ProcessingActor + #inspect + Concurrent::ImmutableStruct
  • @@ -3046,24 +3046,24 @@

    Method List

  • - #inspect - Concurrent::MutableStruct + #inspect + Concurrent::SettableStruct
  • - #inspect - Concurrent::SettableStruct + #inspect + Concurrent::MutableStruct
  • - #inspect - Concurrent::ImmutableStruct + #inspect + Concurrent::ProcessingActor
  • @@ -3150,8 +3150,8 @@

    Method List

  • - #kill - Concurrent::SingleThreadExecutor + #kill + Concurrent::SimpleExecutorService
  • @@ -3166,16 +3166,16 @@

    Method List

  • - #kill - Concurrent::SimpleExecutorService + #kill + Concurrent::TimerSet
  • - #kill - Concurrent::TimerSet + #kill + Concurrent::SingleThreadExecutor
  • @@ -3308,22 +3308,6 @@

    Method List

    -
  • -
    - #marshal_dump - Concurrent::Map -
    -
  • - - -
  • -
    - #marshal_load - Concurrent::Map -
    -
  • - -
  • #max_length @@ -3462,16 +3446,16 @@

    Method List

  • - new - Concurrent::ImmutableStruct + new + Concurrent::SettableStruct
  • - new - Concurrent::SettableStruct + new + Concurrent::ImmutableStruct
  • @@ -3510,16 +3494,16 @@

    Method List

  • - #next - Concurrent::Channel::Buffer::Unbuffered + #next + Concurrent::Channel::Buffer::Timer
  • - #next - Concurrent::Channel + #next + Concurrent::Channel::Buffer::Unbuffered
  • @@ -3534,8 +3518,8 @@

    Method List

  • - #next - Concurrent::Channel::Buffer::Timer + #next + Concurrent::Channel
  • @@ -3574,7 +3558,7 @@

    Method List

  • - #nothing + nothing Concurrent::Maybe
  • @@ -3582,7 +3566,7 @@

    Method List

  • - nothing + #nothing Concurrent::Maybe
  • @@ -3598,32 +3582,32 @@

    Method List

  • - #notify_and_delete_observers - Concurrent::Collection::CopyOnNotifyObserverSet + #notify_and_delete_observers + Concurrent::Collection::CopyOnWriteObserverSet
  • - #notify_and_delete_observers - Concurrent::Collection::CopyOnWriteObserverSet + #notify_and_delete_observers + Concurrent::Collection::CopyOnNotifyObserverSet
  • - #notify_observers - Concurrent::Collection::CopyOnNotifyObserverSet + #notify_observers + Concurrent::Collection::CopyOnWriteObserverSet
  • - #notify_observers - Concurrent::Collection::CopyOnWriteObserverSet + #notify_observers + Concurrent::Collection::CopyOnNotifyObserverSet
  • @@ -3670,16 +3654,16 @@

    Method List

  • - #offer - Concurrent::Channel::Buffer::Dropping + #offer + Concurrent::Channel::Buffer::Unbuffered
  • - #offer - Concurrent::Channel::Buffer::Timer + #offer + Concurrent::Channel::Buffer::Dropping
  • @@ -3694,24 +3678,24 @@

    Method List

  • - #offer - Concurrent::Channel::Buffer::Buffered + #offer + Concurrent::Channel::Buffer::Timer
  • - #offer - Concurrent::Channel::Buffer::Unbuffered + #offer + Concurrent::Channel
  • - #offer - Concurrent::Channel + #offer + Concurrent::Channel::Buffer::Buffered
  • @@ -3742,40 +3726,40 @@

    Method List

  • - #on_envelope - Concurrent::Actor::Behaviour::Abstract + #on_envelope + Concurrent::Actor::Behaviour::SetResults
  • - #on_envelope - Concurrent::Actor::Behaviour::ErrorsOnUnknownMessage + #on_envelope + Concurrent::Actor::Behaviour::ExecutesContext
  • - #on_envelope - Concurrent::Actor::Behaviour::ExecutesContext + #on_envelope + Concurrent::Actor::Behaviour::Linking
  • - #on_envelope - Concurrent::Actor::Behaviour::RemovesChild + #on_envelope + Concurrent::Actor::Behaviour::ErrorsOnUnknownMessage
  • - #on_envelope - Concurrent::Actor::Behaviour::SetResults + #on_envelope + Concurrent::Actor::Behaviour::Awaits
  • @@ -3790,80 +3774,80 @@

    Method List

  • - #on_envelope - Concurrent::Actor::Behaviour::Supervising + #on_envelope + Concurrent::Actor::Core
  • - #on_envelope - Concurrent::Actor::Core + #on_envelope + Concurrent::Actor::Behaviour::RemovesChild
  • - #on_envelope - Concurrent::Actor::AbstractContext + #on_envelope + Concurrent::Actor::Behaviour::Pausing
  • - #on_envelope - Concurrent::Actor::Behaviour::Awaits + #on_envelope + Concurrent::Actor::Behaviour::Buffer
  • - #on_envelope - Concurrent::Actor::Behaviour::Buffer + #on_envelope + Concurrent::Actor::Behaviour::Abstract
  • - #on_envelope - Concurrent::Actor::Behaviour::Linking + #on_envelope + Concurrent::Actor::Behaviour::Supervising
  • - #on_envelope - Concurrent::Actor::Behaviour::Pausing + #on_envelope + Concurrent::Actor::AbstractContext
  • - #on_event - Concurrent::Actor::Behaviour::ExecutesContext + #on_event + Concurrent::Actor::AbstractContext
  • - #on_event - Concurrent::Actor::AbstractContext + #on_event + Concurrent::Actor::Behaviour::Abstract
  • - #on_event - Concurrent::Actor::Behaviour::Abstract + #on_event + Concurrent::Actor::Behaviour::Pausing
  • @@ -3878,16 +3862,16 @@

    Method List

  • - #on_event - Concurrent::Actor::Behaviour::Pausing + #on_event + Concurrent::Actor::Behaviour::Buffer
  • - #on_event - Concurrent::Actor::Behaviour::Buffer + #on_event + Concurrent::Actor::Behaviour::ExecutesContext
  • @@ -3918,16 +3902,16 @@

    Method List

  • - #on_message - Concurrent::Actor::Root + #on_message + Concurrent::Actor::Utils::Broadcast
  • - #on_message - Concurrent::Actor::DefaultDeadLetterHandler + #on_message + Concurrent::Actor::Root
  • @@ -3942,32 +3926,32 @@

    Method List

  • - #on_message - Concurrent::Actor::Utils::AsAdHoc + #on_message + Concurrent::Actor::AbstractContext
  • - #on_message - Concurrent::Actor::AbstractContext + #on_message + Concurrent::Actor::DefaultDeadLetterHandler
  • - #on_message - Concurrent::Actor::Utils::Balancer + #on_message + Concurrent::Actor::Utils::AsAdHoc
  • - #on_message - Concurrent::Actor::Utils::Broadcast + #on_message + Concurrent::Actor::Utils::Balancer
  • @@ -4142,24 +4126,24 @@

    Method List

  • - #poll - Concurrent::Channel::Buffer::Timer + #poll + Concurrent::Channel
  • - #poll - Concurrent::Channel::Buffer::Base + #poll + Concurrent::Channel::Buffer::Timer
  • - #poll - Concurrent::Channel + #poll + Concurrent::Channel::Buffer::Base
  • @@ -4214,32 +4198,32 @@

    Method List

  • - #post - Concurrent::ThreadPoolExecutor + #post + Concurrent::SimpleExecutorService
  • - post - Concurrent::SimpleExecutorService + #post + Concurrent::IndirectImmediateExecutor
  • - #post - Concurrent::TimerSet + #post + Concurrent::ImmediateExecutor
  • - #post - Concurrent::SimpleExecutorService + #post + Concurrent::TimerSet
  • @@ -4254,32 +4238,32 @@

    Method List

  • - #post - Concurrent::SerializedExecutionDelegator + #post + Concurrent::SerializedExecution
  • - #post - Concurrent::ImmediateExecutor + post + Concurrent::SimpleExecutorService
  • - #post - Concurrent::SerializedExecution + #post + Concurrent::ThreadPoolExecutor
  • - #post - Concurrent::IndirectImmediateExecutor + #post + Concurrent::SerializedExecutionDelegator
  • @@ -4302,16 +4286,16 @@

    Method List

  • - #process_envelope - Concurrent::Actor::Core + #process_envelope + Concurrent::Actor::Behaviour::Buffer
  • - #process_envelope - Concurrent::Actor::Behaviour::Buffer + #process_envelope + Concurrent::Actor::Core
  • @@ -4342,80 +4326,80 @@

    Method List

  • - #push - Concurrent::LockFreeStack + #push + Concurrent::Promises::Channel
  • - #push - Concurrent::Promises::Channel + #push + Concurrent::LockFreeStack
  • - #put - Concurrent::Channel::Buffer::Base + #put + Concurrent::Channel::Buffer::Sliding
  • - #put - Concurrent::Channel::Buffer::Buffered + #put + Concurrent::Channel::Buffer::Dropping
  • - #put - Concurrent::Channel::Buffer::Dropping + #put + Concurrent::Channel::Buffer::Buffered
  • - #put - Concurrent::MVar + #put + Concurrent::Channel::Buffer::Base
  • - #put - Concurrent::Channel::Buffer::Sliding + #put + Concurrent::Channel::Buffer::Timer
  • - #put - Concurrent::Channel + #put + Concurrent::Channel::Buffer::Unbuffered
  • - #put - Concurrent::Channel::Buffer::Timer + #put + Concurrent::MVar
  • - #put - Concurrent::Channel::Buffer::Unbuffered + #put + Concurrent::Channel
  • @@ -4510,16 +4494,16 @@

    Method List

  • - #reference - Concurrent::Actor::Core + #reference + Concurrent::Actor::PublicDelegations
  • - #reference - Concurrent::Actor::PublicDelegations + #reference + Concurrent::Actor::Core
  • @@ -4582,16 +4566,16 @@

    Method List

  • - #rejected? - Concurrent::Promises::Future + #rejected? + Concurrent::Concern::Obligation
  • - #rejected? - Concurrent::Concern::Obligation + #rejected? + Concurrent::Promises::Future
  • @@ -4606,16 +4590,16 @@

    Method List

  • - #release - Concurrent::Throttle + #release + Concurrent::Semaphore
  • - #release - Concurrent::Semaphore + #release + Concurrent::Throttle
  • @@ -4638,16 +4622,16 @@

    Method List

  • - #release_write_lock - Concurrent::ReentrantReadWriteLock + #release_write_lock + Concurrent::ReadWriteLock
  • - #release_write_lock - Concurrent::ReadWriteLock + #release_write_lock + Concurrent::ReentrantReadWriteLock
  • @@ -4742,32 +4726,32 @@

    Method List

  • - #reset - Concurrent::Atom + #reset + Concurrent::ScheduledTask
  • - #reset - Concurrent::CyclicBarrier + #reset + Concurrent::Event
  • - #reset - Concurrent::Event + #reset + Concurrent::CyclicBarrier
  • - #reset - Concurrent::ScheduledTask + #reset + Concurrent::Atom
  • @@ -4814,16 +4798,16 @@

    Method List

  • - #resolve - Concurrent::Promises::ResolvableEvent + #resolve + Concurrent::Promises::ResolvableFuture
  • - #resolve - Concurrent::Promises::ResolvableFuture + #resolve + Concurrent::Promises::ResolvableEvent
  • @@ -4910,40 +4894,40 @@

    Method List

  • - #running? - Concurrent::SimpleExecutorService + #running? + Concurrent::ImmediateExecutor
  • - #running? - Concurrent::ThreadPoolExecutor + #running? + Concurrent::TimerTask
  • - #running? - Concurrent::ImmediateExecutor + #running? + Concurrent::SingleThreadExecutor
  • - #running? - Concurrent::TimerTask + #running? + Concurrent::SimpleExecutorService
  • - #running? - Concurrent::SingleThreadExecutor + #running? + Concurrent::ThreadPoolExecutor
  • @@ -4974,16 +4958,16 @@

    Method List

  • - #schedule - Concurrent::Promises::Future + #schedule + Concurrent::Promises::FactoryMethods
  • - #schedule - Concurrent::Promises::FactoryMethods + #schedule + Concurrent::Promises::Future
  • @@ -5142,8 +5126,8 @@

    Method List

  • - #set - Concurrent::Event + #set + Concurrent::AtomicReference
  • @@ -5158,40 +5142,40 @@

    Method List

  • - #set - Concurrent::Tuple + #set + Concurrent::AtomicMarkableReference
  • - #set - Concurrent::AtomicReference + #set + Concurrent::IVar
  • - #set - Concurrent::AtomicMarkableReference + #set + Concurrent::Future
  • - #set - Concurrent::IVar + #set + Concurrent::Event
  • - #set - Concurrent::Future + #set + Concurrent::Tuple
  • @@ -5222,16 +5206,16 @@

    Method List

  • - #shutdown - Concurrent::ThreadPoolExecutor + #shutdown + Concurrent::SingleThreadExecutor
  • - #shutdown - Concurrent::SingleThreadExecutor + #shutdown + Concurrent::ThreadPoolExecutor
  • @@ -5254,16 +5238,16 @@

    Method List

  • - #shutdown? - Concurrent::SingleThreadExecutor + #shutdown? + Concurrent::ImmediateExecutor
  • - #shutdown? - Concurrent::ImmediateExecutor + #shutdown? + Concurrent::SingleThreadExecutor
  • @@ -5278,32 +5262,32 @@

    Method List

  • - #shuttingdown? - Concurrent::SingleThreadExecutor + #shuttingdown? + Concurrent::ImmediateExecutor
  • - #shuttingdown? - Concurrent::SimpleExecutorService + #shuttingdown? + Concurrent::ThreadPoolExecutor
  • - #shuttingdown? - Concurrent::ThreadPoolExecutor + #shuttingdown? + Concurrent::SimpleExecutorService
  • - #shuttingdown? - Concurrent::ImmediateExecutor + #shuttingdown? + Concurrent::SingleThreadExecutor
  • @@ -5342,16 +5326,16 @@

    Method List

  • - #size - Concurrent::Tuple + #size + Concurrent::Channel::Buffer::Base
  • - #size - Concurrent::Channel::Buffer::Base + #size + Concurrent::Tuple
  • @@ -5390,16 +5374,16 @@

    Method List

  • - #state - Concurrent::Concern::Obligation + #state + Concurrent::Promises::AbstractEventFuture
  • - #state - Concurrent::Promises::AbstractEventFuture + #state + Concurrent::Concern::Obligation
  • @@ -5446,32 +5430,32 @@

    Method List

  • - #take - Concurrent::MVar + #take + Concurrent::Channel::Buffer::Base
  • - #take - Concurrent::Channel::Buffer::Timer + #take + Concurrent::Channel::Buffer::Buffered
  • - #take - Concurrent::Channel::Buffer::Base + #take + Concurrent::MVar
  • - #take - Concurrent::Channel::Buffer::Buffered + #take + Concurrent::Channel
  • @@ -5486,8 +5470,8 @@

    Method List

  • - #take - Concurrent::Channel + #take + Concurrent::Channel::Buffer::Timer
  • @@ -5542,16 +5526,16 @@

    Method List

  • - #terminate! - Concurrent::Actor::Behaviour::Termination + #terminate! + Concurrent::Actor::InternalDelegations
  • - #terminate! - Concurrent::Actor::InternalDelegations + #terminate! + Concurrent::Actor::Behaviour::Termination
  • @@ -5566,16 +5550,16 @@

    Method List

  • - #terminated? - Concurrent::Actor::InternalDelegations + #terminated? + Concurrent::Actor::Behaviour::Termination
  • - #terminated? - Concurrent::Actor::Behaviour::Termination + #terminated? + Concurrent::Actor::InternalDelegations
  • @@ -5590,16 +5574,16 @@

    Method List

  • - #then - Concurrent::Promises::Future + #then + Concurrent::Promise
  • - #then - Concurrent::Promise + #then + Concurrent::Promises::Future
  • @@ -5726,24 +5710,24 @@

    Method List

  • - #to_event - Concurrent::Cancellation::Token + #to_event + Concurrent::Promises::Future
  • - #to_event - Concurrent::Promises::Future + #to_event + Concurrent::Promises::Event
  • - #to_event - Concurrent::Promises::Event + #to_event + Concurrent::Cancellation::Token
  • @@ -5774,8 +5758,8 @@

    Method List

  • - #to_h - Concurrent::ImmutableStruct + #to_h + Concurrent::MutableStruct
  • @@ -5790,8 +5774,8 @@

    Method List

  • - #to_h - Concurrent::MutableStruct + #to_h + Concurrent::ImmutableStruct
  • @@ -5806,80 +5790,80 @@

    Method List

  • - #to_s - Concurrent::AtomicReference + #to_s + Concurrent::LockFreeStack
  • - #to_s - Concurrent::LockFreeStack + #to_s + Concurrent::Actor::Reference
  • - #to_s - Concurrent::Throttle + #to_s + Concurrent::AtomicFixnum
  • - #to_s - Concurrent::Channel::Tick + #to_s + Concurrent::Throttle
  • - #to_s - Concurrent::Actor::Reference + #to_s + Concurrent::Promises::AbstractEventFuture
  • - #to_s - Concurrent::Promises::AbstractEventFuture + #to_s + Concurrent::Channel::Tick
  • - #to_s - Concurrent::AtomicBoolean + #to_s + Concurrent::Cancellation
  • - #to_s - Concurrent::Cancellation::Token + #to_s + Concurrent::AtomicBoolean
  • - #to_s - Concurrent::Cancellation + #to_s + Concurrent::Cancellation::Token
  • - #to_s - Concurrent::AtomicFixnum + #to_s + Concurrent::AtomicReference
  • @@ -6006,32 +5990,32 @@

    Method List

  • - #try_update - Concurrent::AtomicMarkableReference + #try_update + Concurrent::AtomicReference
  • - #try_update - Concurrent::AtomicReference + #try_update + Concurrent::AtomicMarkableReference
  • - #try_update! - Concurrent::AtomicReference + #try_update! + Concurrent::AtomicMarkableReference
  • - #try_update! - Concurrent::AtomicMarkableReference + #try_update! + Concurrent::AtomicReference
  • @@ -6158,112 +6142,112 @@

    Method List

  • - #value - Concurrent::AtomicBoolean + #value + Concurrent::Delay
  • - #value - Concurrent::Atom + #value + Concurrent::LockFreeStack::Node
  • - #value - Concurrent::LockFreeStack::Node + #value + Concurrent::AtomicBoolean
  • - #value - Concurrent::Agent + #value + Concurrent::TVar
  • - #value - Concurrent::Delay + #value + Concurrent::AtomicMarkableReference
  • - #value - Concurrent::AtomicMarkableReference + #value + Concurrent::Concern::Dereferenceable
  • - #value - Concurrent::Promises::Future + #value + Concurrent::ThreadLocalVar
  • - #value - Concurrent::TVar + #value + Concurrent::Agent
  • - #value - Concurrent::ThreadLocalVar + #value + Concurrent::AtomicFixnum
  • - #value - Concurrent::AtomicFixnum + #value + Concurrent::Promises::Future
  • - #value - Concurrent::Concern::Dereferenceable + #value + Concurrent::Atom
  • - #value! - Concurrent::Delay + #value! + Concurrent::Concern::Obligation
  • - #value! - Concurrent::Promises::Future + #value! + Concurrent::Delay
  • - #value! - Concurrent::Concern::Obligation + #value! + Concurrent::Promises::Future
  • @@ -6278,8 +6262,8 @@

    Method List

  • - #value= - Concurrent::AtomicBoolean + #value= + Concurrent::TVar
  • @@ -6294,8 +6278,8 @@

    Method List

  • - #value= - Concurrent::TVar + #value= + Concurrent::AtomicBoolean
  • @@ -6318,24 +6302,24 @@

    Method List

  • - #values - Concurrent::MutableStruct + #values + Concurrent::ImmutableStruct
  • - #values - Concurrent::ImmutableStruct + #values + Concurrent::Map
  • - #values - Concurrent::Map + #values + Concurrent::MutableStruct
  • @@ -6382,8 +6366,8 @@

    Method List

  • - #wait - Concurrent::Concern::Obligation + #wait + Concurrent::Agent
  • @@ -6398,32 +6382,32 @@

    Method List

  • - #wait - Concurrent::CyclicBarrier + #wait + Concurrent::Promises::AbstractEventFuture
  • - #wait - Concurrent::CountDownLatch + #wait + Concurrent::Delay
  • - #wait - Concurrent::Promises::AbstractEventFuture + #wait + Concurrent::CyclicBarrier
  • - #wait - Concurrent::Event + #wait + Concurrent::Concern::Obligation
  • @@ -6438,16 +6422,16 @@

    Method List

  • - #wait - Concurrent::Delay + #wait + Concurrent::Event
  • - #wait - Concurrent::Agent + #wait + Concurrent::CountDownLatch
  • @@ -6470,32 +6454,32 @@

    Method List

  • - #wait_for_termination - Concurrent::SimpleExecutorService + #wait_for_termination + Concurrent::SingleThreadExecutor
  • - #wait_for_termination - Concurrent::ThreadPoolExecutor + #wait_for_termination + Concurrent::ImmediateExecutor
  • - #wait_for_termination - Concurrent::ImmediateExecutor + #wait_for_termination + Concurrent::ThreadPoolExecutor
  • - #wait_for_termination - Concurrent::SingleThreadExecutor + #wait_for_termination + Concurrent::SimpleExecutorService
  • @@ -6510,32 +6494,32 @@

    Method List

  • - #wait_until - Concurrent::Synchronization::Condition + #wait_until + Concurrent::Synchronization::Lock
  • - #wait_until - Concurrent::Synchronization::Lock + #wait_until + Concurrent::Synchronization::Condition
  • - #with_default_executor - Concurrent::Promises::Event + #with_default_executor + Concurrent::Promises::AbstractEventFuture
  • - #with_default_executor - Concurrent::Promises::AbstractEventFuture + #with_default_executor + Concurrent::Promises::Event
  • @@ -6630,7 +6614,7 @@

    Method List

  • - #zip + zip Concurrent::Promise
  • @@ -6638,8 +6622,8 @@

    Method List

  • - zip - Concurrent::Promise + #zip + Concurrent::Promises::Event
  • @@ -6654,8 +6638,8 @@

    Method List

  • - #zip - Concurrent::Promises::Event + #zip + Concurrent::Promise
  • diff --git a/lib/concurrent/atomic/atomic_reference.rb b/lib/concurrent/atomic/atomic_reference.rb index 8fa3c4ef5..620c0698e 100644 --- a/lib/concurrent/atomic/atomic_reference.rb +++ b/lib/concurrent/atomic/atomic_reference.rb @@ -4,6 +4,7 @@ # Shim for TruffleRuby::AtomicReference if Concurrent.on_truffleruby? && !defined?(TruffleRuby::AtomicReference) + # @!visibility private module TruffleRuby AtomicReference = Truffle::AtomicReference end diff --git a/lib/concurrent/map.rb b/lib/concurrent/map.rb index 81094821b..dd21de9a7 100644 --- a/lib/concurrent/map.rb +++ b/lib/concurrent/map.rb @@ -31,46 +31,89 @@ module Collection # -- for instance, it does not necessarily retain ordering by insertion time as `Hash` # does. For most uses it should do fine though, and we recommend you consider # `Concurrent::Map` instead of `Concurrent::Hash` for your concurrency-safe hash needs. - # - # > require 'concurrent' - # > - # > map = Concurrent::Map.new class Map < Collection::MapImplementation - # @!macro map_method_is_atomic - # This method is atomic. Atomic methods of `Map` which accept a block - # do not allow the `self` instance to be used within the block. Doing - # so will cause a deadlock. + # @!macro map.atomic_method + # This method is atomic. + + # @!macro map.atomic_method_with_block + # This method is atomic. + # @note Atomic methods taking a block do not allow the `self` instance + # to be used within the block. Doing so will cause a deadlock. + + # @!method compute_if_absent(key) + # Compute and store new value for key if the key is absent. + # @param [Object] key + # @yield new value + # @yieldreturn [Object] new value + # @return [Object] new value or current value + # @!macro map.atomic_method_with_block + + # @!method compute_if_present(key) + # Compute and store new value for key if the key is present. + # @param [Object] key + # @yield new value + # @yieldparam old_value [Object] + # @yieldreturn [Object, nil] new value, when nil the key is removed + # @return [Object, nil] new value or nil + # @!macro map.atomic_method_with_block + + # @!method compute(key) + # Compute and store new value for key. + # @param [Object] key + # @yield compute new value from old one + # @yieldparam old_value [Object, nil] old_value, or nil when key is absent + # @yieldreturn [Object, nil] new value, when nil the key is removed + # @return [Object, nil] new value or nil + # @!macro map.atomic_method_with_block + + # @!method merge_pair(key, value) + # If the key is absent, the value is stored, otherwise new value is + # computed with a block. + # @param [Object] key + # @param [Object] value + # @yield compute new value from old one + # @yieldparam old_value [Object] old value + # @yieldreturn [Object, nil] new value, when nil the key is removed + # @return [Object, nil] new value or nil + # @!macro map.atomic_method_with_block + + # @!method replace_pair(key, old_value, new_value) + # Replaces old_value with new_value if key exists and current value + # matches old_value + # @param [Object] key + # @param [Object] old_value + # @param [Object] new_value + # @return [true, false] true if replaced + # @!macro map.atomic_method + + # @!method replace_if_exists(key, new_value) + # Replaces current value with new_value if key exists + # @param [Object] key + # @param [Object] new_value + # @return [Object, nil] old value or nil + # @!macro map.atomic_method + + # @!method get_and_set(key, value) + # Get the current value under key and set new value. + # @param [Object] key + # @param [Object] value + # @return [Object, nil] old value or nil when the key was absent + # @!macro map.atomic_method + + # @!method delete(key) + # Delete key and its value. + # @param [Object] key + # @return [Object, nil] old value or nil when the key was absent + # @!macro map.atomic_method + + # @!method delete_pair(key, value) + # Delete pair and its value if current value equals the provided value. + # @param [Object] key + # @param [Object] value + # @return [true, false] true if deleted + # @!macro map.atomic_method - # @!method put_if_absent - # @!macro map_method_is_atomic - - # @!method compute_if_absent - # @!macro map_method_is_atomic - - # @!method compute_if_present - # @!macro map_method_is_atomic - - # @!method compute - # @!macro map_method_is_atomic - - # @!method merge_pair - # @!macro map_method_is_atomic - - # @!method replace_pair - # @!macro map_method_is_atomic - - # @!method replace_if_exists - # @!macro map_method_is_atomic - - # @!method get_and_set - # @!macro map_method_is_atomic - - # @!method delete - # @!macro map_method_is_atomic - - # @!method delete_pair - # @!macro map_method_is_atomic def initialize(options = nil, &block) if options.kind_of?(::Hash) @@ -83,6 +126,9 @@ def initialize(options = nil, &block) @default_proc = block end + # Get a value with key + # @param [Object] key + # @return [Object] the value def [](key) if value = super # non-falsy value is an existing mapping, return it right away value @@ -98,17 +144,27 @@ def [](key) end alias_method :get, :[] + # TODO (pitr-ch 30-Oct-2018): doc alias_method :put, :[]= + # Get a value with key, or default_value when key is absent, + # or fail when no default_value is given. + # @param [Object] key + # @param [Object] default_value + # @yield default value for a key + # @yieldparam key [Object] + # @yieldreturn [Object] default value + # @return [Object] the value or default value + # @raise [KeyError] when key is missing and no default_value is provided # @!macro map_method_not_atomic - # The "fetch-then-act" methods of `Map` are not atomic. `Map` is intended - # to be use as a concurrency primitive with strong happens-before - # guarantees. It is not intended to be used as a high-level abstraction - # supporting complex operations. All read and write operations are - # thread safe, but no guarantees are made regarding race conditions - # between the fetch operation and yielding to the block. Additionally, - # this method does not support recursion. This is due to internal - # constraints that are very unlikely to change in the near future. + # @note The "fetch-then-act" methods of `Map` are not atomic. `Map` is intended + # to be use as a concurrency primitive with strong happens-before + # guarantees. It is not intended to be used as a high-level abstraction + # supporting complex operations. All read and write operations are + # thread safe, but no guarantees are made regarding race conditions + # between the fetch operation and yielding to the block. Additionally, + # this method does not support recursion. This is due to internal + # constraints that are very unlikely to change in the near future. def fetch(key, default_value = NULL) if NULL != (value = get_or_default(key, NULL)) value @@ -121,14 +177,27 @@ def fetch(key, default_value = NULL) end end - # @!macro map_method_not_atomic + # Fetch value with key, or store default value when key is absent, + # or fail when no default_value is given. This is a two step operation, + # therefore not atomic. The store can overwrite other concurrently + # stored value. + # @param [Object] key + # @param [Object] default_value + # @yield default value for a key + # @yieldparam key [Object] + # @yieldreturn [Object] default value + # @return [Object] the value or default value + # @!macro map.atomic_method_with_block def fetch_or_store(key, default_value = NULL) fetch(key) do put(key, block_given? ? yield(key) : (NULL == default_value ? raise_fetch_no_key : default_value)) end end - # @!macro map_method_is_atomic + # Insert value into map with key if key is absent in one atomic step. + # @param [Object] key + # @param [Object] value + # @return [Object, nil] the value or nil when key was present def put_if_absent(key, value) computed = false result = compute_if_absent(key) do @@ -138,6 +207,9 @@ def put_if_absent(key, value) computed ? nil : result end unless method_defined?(:put_if_absent) + # Is the value stored in the map. Iterates over all values. + # @param [Object] value + # @return [true, false] def value?(value) each_value do |v| return true if value.equal?(v) @@ -145,26 +217,46 @@ def value?(value) false end + # All keys + # @return [::Array] keys def keys arr = [] each_pair {|k, v| arr << k} arr end unless method_defined?(:keys) + # All values + # @return [::Array] values def values arr = [] each_pair {|k, v| arr << v} arr end unless method_defined?(:values) + # Iterates over each key. + # @yield for each key in the map + # @yieldparam key [Object] + # @return [self] + # @!macro map.atomic_method_with_block def each_key each_pair {|k, v| yield k} end unless method_defined?(:each_key) + # Iterates over each value. + # @yield for each value in the map + # @yieldparam value [Object] + # @return [self] + # @!macro map.atomic_method_with_block def each_value each_pair {|k, v| yield v} end unless method_defined?(:each_value) + # Iterates over each key value pair. + # @yield for each key value pair in the map + # @yieldparam key [Object] + # @yieldparam value [Object] + # @return [self] + # @!macro map.atomic_method_with_block def each_pair return enum_for :each_pair unless block_given? super @@ -172,23 +264,31 @@ def each_pair alias_method :each, :each_pair unless method_defined?(:each) + # Find key of a value. + # @param [Object] value + # @return [Object, nil] key or nil when not found def key(value) each_pair {|k, v| return k if v == value} nil end unless method_defined?(:key) alias_method :index, :key if RUBY_VERSION < '1.9' + # Is map empty? + # @return [true, false] def empty? each_pair {|k, v| return false} true end unless method_defined?(:empty?) + # The size of map. + # @return [Integer] size def size count = 0 each_pair {|k, v| count += 1} count end unless method_defined?(:size) + # @!visibility private def marshal_dump raise TypeError, "can't dump hash with default proc" if @default_proc h = {} @@ -196,6 +296,7 @@ def marshal_dump h end + # @!visibility private def marshal_load(hash) initialize populate_from(hash) From ec78b1f11ad6203cd6f4b18ea827800e6f71e86b Mon Sep 17 00:00:00 2001 From: Petr Chalupa Date: Tue, 30 Oct 2018 20:45:56 +0100 Subject: [PATCH 2/2] Formatting the code --- lib/concurrent/map.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/concurrent/map.rb b/lib/concurrent/map.rb index dd21de9a7..5b7144747 100644 --- a/lib/concurrent/map.rb +++ b/lib/concurrent/map.rb @@ -200,7 +200,7 @@ def fetch_or_store(key, default_value = NULL) # @return [Object, nil] the value or nil when key was present def put_if_absent(key, value) computed = false - result = compute_if_absent(key) do + result = compute_if_absent(key) do computed = true value end @@ -221,7 +221,7 @@ def value?(value) # @return [::Array] keys def keys arr = [] - each_pair {|k, v| arr << k} + each_pair { |k, v| arr << k } arr end unless method_defined?(:keys) @@ -229,7 +229,7 @@ def keys # @return [::Array] values def values arr = [] - each_pair {|k, v| arr << v} + each_pair { |k, v| arr << v } arr end unless method_defined?(:values) @@ -239,7 +239,7 @@ def values # @return [self] # @!macro map.atomic_method_with_block def each_key - each_pair {|k, v| yield k} + each_pair { |k, v| yield k } end unless method_defined?(:each_key) # Iterates over each value. @@ -248,7 +248,7 @@ def each_key # @return [self] # @!macro map.atomic_method_with_block def each_value - each_pair {|k, v| yield v} + each_pair { |k, v| yield v } end unless method_defined?(:each_value) # Iterates over each key value pair. @@ -268,7 +268,7 @@ def each_pair # @param [Object] value # @return [Object, nil] key or nil when not found def key(value) - each_pair {|k, v| return k if v == value} + each_pair { |k, v| return k if v == value } nil end unless method_defined?(:key) alias_method :index, :key if RUBY_VERSION < '1.9' @@ -276,7 +276,7 @@ def key(value) # Is map empty? # @return [true, false] def empty? - each_pair {|k, v| return false} + each_pair { |k, v| return false } true end unless method_defined?(:empty?) @@ -284,7 +284,7 @@ def empty? # @return [Integer] size def size count = 0 - each_pair {|k, v| count += 1} + each_pair { |k, v| count += 1 } count end unless method_defined?(:size) @@ -292,7 +292,7 @@ def size def marshal_dump raise TypeError, "can't dump hash with default proc" if @default_proc h = {} - each_pair {|k, v| h[k] = v} + each_pair { |k, v| h[k] = v } h end @@ -310,6 +310,7 @@ def inspect end private + def raise_fetch_no_key raise KeyError, 'key not found' end @@ -320,7 +321,7 @@ def initialize_copy(other) end def populate_from(hash) - hash.each_pair {|k, v| self[k] = v} + hash.each_pair { |k, v| self[k] = v } self end