concurrent-ruby 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01c9677c137013ec86d98778a4aa6a9e69bca9b0ae29e923a37254c9cdc515fe
4
- data.tar.gz: 3be169b6d0a11914f85e4a0e1221cd5c122bd59035abe9718892e1a3b4bc690b
3
+ metadata.gz: 14d5a264c6fdc7b6087131a0f0a2fc1ce661d18029440e426e094443eb359ca6
4
+ data.tar.gz: 42e7b1b8fb885aec9b7b08488c6682af2743e65ad6dcd731f8c86d34f7768981
5
5
  SHA512:
6
- metadata.gz: 89544dfc5575906cac0f5c57ce5348b944a70a6f77154fb70d0f185b9cc79344a5bb5147a7cf22808e071b4213c80c94e3036b98a2f4102018daf8ba16492db8
7
- data.tar.gz: f084a5a9aa8c6e2ad305fe360f1e8e3b264ad0b45f7add6c04561ff4945cbf0b7c30b2c0d6801be46bc61b3f22f60975e8397973a321268bbf302f4bcb65ab24
6
+ metadata.gz: 31b6cf4fcc533349681610e74f6261c95e5c664583014d86101578f0380a6889288b29a89314a5da59e92cd422bcd97783c34d99c3e5c21a90db0f0d3fcc57e1
7
+ data.tar.gz: 4438de87d8ec3ff1cc6d7d246821002bbb76d5a9ddd8b77ebf4a15c0449f1509d694c4f57936b1e1a69e19f32736f21518fd8e82b8cdfbb99d5e2948976c230e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## Current
2
2
 
3
+ ## Release v1.3.5, edge v0.7.2 (15 January 2025)
4
+
5
+ concurrent-ruby:
6
+
7
+ * (#1062) Remove dependency on logger.
8
+
9
+ concurrent-ruby-edge:
10
+
11
+ * (#1062) Remove dependency on logger.
12
+
3
13
  ## Release v1.3.4 (10 August 2024)
4
14
 
5
15
  * (#1060) Fix bug with return value of `Concurrent.available_processor_count` when `cpu.cfs_quota_us` is -1.
@@ -296,7 +306,7 @@ concurrent-ruby-edge:
296
306
  * Simplification of `RubySingleThreadExecutor`
297
307
  * `Async` improvements
298
308
  - Each object uses its own `SingleThreadExecutor` instead of the global thread pool.
299
- - No longers supports executor injection
309
+ - No longer supports executor injection
300
310
  - Much better documentation
301
311
  * `Atom` updates
302
312
  - No longer `Dereferenceable`
@@ -471,7 +481,7 @@ Please see the [roadmap](https://github.com/ruby-concurrency/concurrent-ruby/iss
471
481
  * Fixed bug with return value of `Concurrent::Actor::Utils::Pool#ask`
472
482
  * Fixed timing bug in `TimerTask`
473
483
  * Fixed bug when creating a `JavaThreadPoolExecutor` with minimum pool size of zero
474
- * Removed confusing warning when not using native extenstions
484
+ * Removed confusing warning when not using native extensions
475
485
  * Improved documentation
476
486
 
477
487
  ## Release v0.7.0 (13 August 2014)
data/README.md CHANGED
@@ -284,7 +284,7 @@ To use the tools in the Edge gem it must be required separately:
284
284
  require 'concurrent-edge'
285
285
  ```
286
286
 
287
- If the library does not behave as expected, `Concurrent.use_stdlib_logger(Logger::DEBUG)` could
287
+ If the library does not behave as expected, `Concurrent.use_simple_logger(:DEBUG)` could
288
288
  help to reveal the problem.
289
289
 
290
290
  ## Installation
data/Rakefile CHANGED
@@ -12,6 +12,8 @@ ENV['JRUBY_HOME'] = ENV['CONCURRENT_JRUBY_HOME'] if ENV['CONCURRENT_JRUBY_HOME']
12
12
  Rake::JavaExtensionTask.new('concurrent_ruby', core_gemspec) do |ext|
13
13
  ext.ext_dir = 'ext/concurrent-ruby'
14
14
  ext.lib_dir = 'lib/concurrent-ruby/concurrent'
15
+ ext.source_version = '8'
16
+ ext.target_version = '8'
15
17
  end
16
18
 
17
19
  if RUBY_ENGINE == 'ruby'
@@ -481,7 +481,7 @@ public class ConcurrentHashMapV8<K, V>
481
481
  *
482
482
  * Maintaining API and serialization compatibility with previous
483
483
  * versions of this class introduces several oddities. Mainly: We
484
- * leave untouched but unused constructor arguments refering to
484
+ * leave untouched but unused constructor arguments referring to
485
485
  * concurrencyLevel. We accept a loadFactor constructor argument,
486
486
  * but apply it only to initial table capacity (which is the only
487
487
  * time that we can guarantee to honor it.) We also declare an
@@ -484,7 +484,7 @@ public class ConcurrentHashMapV8<K, V>
484
484
  *
485
485
  * Maintaining API and serialization compatibility with previous
486
486
  * versions of this class introduces several oddities. Mainly: We
487
- * leave untouched but unused constructor arguments refering to
487
+ * leave untouched but unused constructor arguments referring to
488
488
  * concurrencyLevel. We accept a loadFactor constructor argument,
489
489
  * but apply it only to initial table capacity (which is the only
490
490
  * time that we can guarantee to honor it.) We also declare an
@@ -371,7 +371,7 @@ module Concurrent
371
371
  # @param [Float] timeout the maximum number of seconds to wait
372
372
  # @return [Boolean] true if all actions complete before timeout
373
373
  #
374
- # @raise [Concurrent::TimeoutError] when timout is reached
374
+ # @raise [Concurrent::TimeoutError] when timeout is reached
375
375
  #
376
376
  # @!macro agent_await_warning
377
377
  def await_for!(timeout)
@@ -477,7 +477,7 @@ module Concurrent
477
477
  # @param [Array<Concurrent::Agent>] agents the Agents on which to wait
478
478
  # @return [Boolean] true if all actions complete before timeout
479
479
  #
480
- # @raise [Concurrent::TimeoutError] when timout is reached
480
+ # @raise [Concurrent::TimeoutError] when timeout is reached
481
481
  # @!macro agent_await_warning
482
482
  def await_for!(timeout, *agents)
483
483
  raise Concurrent::TimeoutError unless await_for(timeout, *agents)
@@ -218,7 +218,7 @@ module Concurrent
218
218
 
219
219
  # @!method self.new(*args, &block)
220
220
  #
221
- # Instanciate a new object and ensure proper initialization of the
221
+ # Instantiate a new object and ensure proper initialization of the
222
222
  # synchronization mechanisms.
223
223
  #
224
224
  # @param [Array<Object>] args Zero or more arguments to be passed to the
@@ -113,7 +113,7 @@ module Concurrent
113
113
  # @option opts [Proc] :validator (nil) Optional proc used to validate new
114
114
  # values. It must accept one and only one argument which will be the
115
115
  # intended new value. The validator will return true if the new value
116
- # is acceptable else return false (preferrably) or raise an exception.
116
+ # is acceptable else return false (preferably) or raise an exception.
117
117
  #
118
118
  # @!macro deref_options
119
119
  #
@@ -1,4 +1,3 @@
1
- require 'logger'
2
1
  require 'concurrent/atomic/atomic_reference'
3
2
 
4
3
  module Concurrent
@@ -8,10 +7,12 @@ module Concurrent
8
7
  #
9
8
  # @!visibility private
10
9
  module Logging
11
- include Logger::Severity
10
+ # The same as Logger::Severity but we copy it here to avoid a dependency on the logger gem just for these 7 constants
11
+ DEBUG, INFO, WARN, ERROR, FATAL, UNKNOWN = 0, 1, 2, 3, 4, 5
12
+ SEV_LABEL = %w[DEBUG INFO WARN ERROR FATAL ANY].freeze
12
13
 
13
14
  # Logs through {Concurrent.global_logger}, it can be overridden by setting @logger
14
- # @param [Integer] level one of Logger::Severity constants
15
+ # @param [Integer] level one of Concurrent::Concern::Logging constants
15
16
  # @param [String] progname e.g. a path of an Actor
16
17
  # @param [String, nil] message when nil block is used to generate the message
17
18
  # @yieldreturn [String] a message
@@ -23,7 +24,7 @@ module Concurrent
23
24
  end
24
25
  logger.call level, progname, message, &block
25
26
  rescue => error
26
- $stderr.puts "`Concurrent.configuration.logger` failed to log #{[level, progname, message, block]}\n" +
27
+ $stderr.puts "`Concurrent.global_logger` failed to log #{[level, progname, message, block]}\n" +
27
28
  "#{error.message} (#{error.class})\n#{error.backtrace.join "\n"}"
28
29
  end
29
30
  end
@@ -33,8 +34,10 @@ end
33
34
  module Concurrent
34
35
  extend Concern::Logging
35
36
 
36
- # @return [Logger] Logger with provided level and output.
37
- def self.create_simple_logger(level = Logger::FATAL, output = $stderr)
37
+ # Create a simple logger with provided level and output.
38
+ def self.create_simple_logger(level = :FATAL, output = $stderr)
39
+ level = Concern::Logging.const_get(level) unless level.is_a?(Integer)
40
+
38
41
  # TODO (pitr-ch 24-Dec-2016): figure out why it had to be replaced, stdlogger was deadlocking
39
42
  lambda do |severity, progname, message = nil, &block|
40
43
  return false if severity < level
@@ -52,7 +55,7 @@ module Concurrent
52
55
 
53
56
  output.print format "[%s] %5s -- %s: %s\n",
54
57
  Time.now.strftime('%Y-%m-%d %H:%M:%S.%L'),
55
- Logger::SEV_LABEL[severity],
58
+ Concern::Logging::SEV_LABEL[severity],
56
59
  progname,
57
60
  formatted_message
58
61
  true
@@ -60,13 +63,15 @@ module Concurrent
60
63
  end
61
64
 
62
65
  # Use logger created by #create_simple_logger to log concurrent-ruby messages.
63
- def self.use_simple_logger(level = Logger::FATAL, output = $stderr)
66
+ def self.use_simple_logger(level = :FATAL, output = $stderr)
64
67
  Concurrent.global_logger = create_simple_logger level, output
65
68
  end
66
69
 
67
- # @return [Logger] Logger with provided level and output.
70
+ # Create a stdlib logger with provided level and output.
71
+ # If you use this deprecated method you might need to add logger to your Gemfile to avoid warnings from Ruby 3.3.5+.
68
72
  # @deprecated
69
- def self.create_stdlib_logger(level = Logger::FATAL, output = $stderr)
73
+ def self.create_stdlib_logger(level = :FATAL, output = $stderr)
74
+ require 'logger'
70
75
  logger = Logger.new(output)
71
76
  logger.level = level
72
77
  logger.formatter = lambda do |severity, datetime, progname, msg|
@@ -93,7 +98,7 @@ module Concurrent
93
98
 
94
99
  # Use logger created by #create_stdlib_logger to log concurrent-ruby messages.
95
100
  # @deprecated
96
- def self.use_stdlib_logger(level = Logger::FATAL, output = $stderr)
101
+ def self.use_stdlib_logger(level = :FATAL, output = $stderr)
97
102
  Concurrent.global_logger = create_stdlib_logger level, output
98
103
  end
99
104
 
@@ -103,7 +108,7 @@ module Concurrent
103
108
  NULL_LOGGER = lambda { |level, progname, message = nil, &block| }
104
109
 
105
110
  # @!visibility private
106
- GLOBAL_LOGGER = AtomicReference.new(create_simple_logger(Logger::WARN))
111
+ GLOBAL_LOGGER = AtomicReference.new(create_simple_logger(:WARN))
107
112
  private_constant :GLOBAL_LOGGER
108
113
 
109
114
  def self.global_logger
@@ -19,7 +19,7 @@ module Concurrent
19
19
  #
20
20
  # When a `Delay` is created its state is set to `pending`. The value and
21
21
  # reason are both `nil`. The first time the `#value` method is called the
22
- # enclosed opration will be run and the calling thread will block. Other
22
+ # enclosed operation will be run and the calling thread will block. Other
23
23
  # threads attempting to call `#value` will block as well. Once the operation
24
24
  # is complete the *value* will be set to the result of the operation or the
25
25
  # *reason* will be set to the raised exception, as appropriate. All threads
@@ -83,7 +83,7 @@ module Concurrent
83
83
  #
84
84
  # This is a no-op on some pool implementation (e.g. the Java one). The Ruby
85
85
  # pool will auto-prune each time a new job is posted. You will need to call
86
- # this method explicitely in case your application post jobs in bursts (a
86
+ # this method explicitly in case your application post jobs in bursts (a
87
87
  # lot of jobs and then nothing for long periods)
88
88
 
89
89
  # @!macro thread_pool_executor_public_api
@@ -27,7 +27,7 @@ module Concurrent
27
27
  # is received. This pattern has several issues. The thread itself is highly
28
28
  # susceptible to errors during processing. Also, the thread itself must be
29
29
  # constantly monitored and restarted should it die. `SingleThreadExecutor`
30
- # encapsulates all these bahaviors. The task processor is highly resilient
30
+ # encapsulates all these behaviors. The task processor is highly resilient
31
31
  # to errors from within tasks. Also, should the thread die it will
32
32
  # automatically be restarted.
33
33
  #
@@ -148,7 +148,7 @@ module Concurrent
148
148
  if value = super # non-falsy value is an existing mapping, return it right away
149
149
  value
150
150
  # re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
151
- # a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
151
+ # a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrect +nil+ value
152
152
  # would be returned)
153
153
  # note: nil == value check is not technically necessary
154
154
  elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@@ -103,7 +103,7 @@ module Concurrent
103
103
  # - if parent is *rejected* the child will be *pending* (but will ultimately be *rejected*)
104
104
  #
105
105
  # Promises are executed asynchronously from the main thread. By the time a
106
- # child Promise finishes intialization it may be in a different state than its
106
+ # child Promise finishes initialization it may be in a different state than its
107
107
  # parent (by the time a child is created its parent may have completed
108
108
  # execution and changed state). Despite being asynchronous, however, the order
109
109
  # of execution of Promise objects in a chain (or tree) is strictly defined.
@@ -193,7 +193,7 @@ module Concurrent
193
193
  end
194
194
  end
195
195
 
196
- # The `delay` value given at instanciation.
196
+ # The `delay` value given at instantiation.
197
197
  #
198
198
  # @return [Float] the initial delay.
199
199
  def initial_delay
@@ -157,7 +157,7 @@ module Concurrent
157
157
  end
158
158
  end
159
159
  members.each_with_index do |member, index|
160
- clazz.send :remove_method, member if clazz.instance_methods.include? member
160
+ clazz.send :remove_method, member if clazz.instance_methods(false).include? member
161
161
  clazz.send(:define_method, member) do
162
162
  @values[index]
163
163
  end
@@ -58,7 +58,7 @@ module Concurrent
58
58
 
59
59
  # Creates methods for reading and writing to a instance variable with
60
60
  # volatile (Java) semantic as {.attr_volatile} does.
61
- # The instance variable should be accessed oly through generated methods.
61
+ # The instance variable should be accessed only through generated methods.
62
62
  # This method generates following methods: `value`, `value=(new_value) #=> new_value`,
63
63
  # `swap_value(new_value) #=> old_value`,
64
64
  # `compare_and_set_value(expected, value) #=> true || false`, `update_value(&block)`.
@@ -9,7 +9,7 @@ module Concurrent
9
9
  # @!visibility private
10
10
  module Util
11
11
 
12
- # A Ruby port of the Doug Lea's jsr166e.LondAdder class version 1.8
12
+ # A Ruby port of the Doug Lea's jsr166e.LongAdder class version 1.8
13
13
  # available in public domain.
14
14
  #
15
15
  # Original source code available here:
@@ -15,7 +15,7 @@ module Concurrent
15
15
  # Usage:
16
16
  # x = XorShiftRandom.get # uses Kernel.rand to generate an initial seed
17
17
  # while true
18
- # if (x = XorShiftRandom.xorshift).odd? # thread-localy generate a next random number
18
+ # if (x = XorShiftRandom.xorshift).odd? # thread-locally generate a next random number
19
19
  # do_something_at_random
20
20
  # end
21
21
  # end
@@ -1,3 +1,3 @@
1
1
  module Concurrent
2
- VERSION = '1.3.4'
2
+ VERSION = '1.3.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry D'Antonio
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-08-10 00:00:00.000000000 Z
13
+ date: 2025-01-15 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: |
16
16
  Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.