smart_engine 0.16.0 → 0.17.0

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: f3f6a846502241aa2029b692dc4f0c81ee004527a3242b750b7c6ea10a37872a
4
- data.tar.gz: 9bec4690bf081407fc7262610e978065f99422f57df2c1d673469d53cf6f142f
3
+ metadata.gz: 1f2e00e5e76c385efb45b5718cf06001da83309a1dc7e09a32c0b84131c76904
4
+ data.tar.gz: 3e6b356d9c108f423e482874556312b26af2247aea4a7f8e8150ecb9827fb936
5
5
  SHA512:
6
- metadata.gz: 40e93990c49475cf764d2baf118f32409d0cc6461f5892de680d5222f040110f17c755540284c35a5dbf34d604a62d5255a5d63fa7e9c03035fad1680eafa867
7
- data.tar.gz: c182166a23faf3ae36202af92048b1a258847ea1de9541deabbee367101af68cfb67bb1d818c634ae8a92da7e8a24c4f94102185f8a7c75c3b43c2da9057f456
6
+ metadata.gz: acb16bc9be8e2c8865241cb4584a657b2172318d60bb01726f9886b591248f9e79ffb5dfe378f0a66e94cab0ccd6347c77f43237d1af043d3d83d34b4f22ce1c
7
+ data.tar.gz: 40e44b17967ade1ac69adf5109a5894836fab5b726e2b216c5df445baf6e0405b4cd6c3f1e69131cae3e2c3ee337321ff8ca7fe5c3a12abc1dc2db117f205b9a
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.17.0] - 2022-10-14
5
+ ### Changed
6
+ - **SmartCore::Engine::ReadWriteLock**: allow #read_sync invocations inside #write_sync;
7
+
4
8
  ## [0.16.0] - 2022-09-30
5
9
  ### Changed
6
10
  - `SmartCore::Engine::ReadWriteLock` does not lock the current thread if the current thread has already acquired the lock;
data/README.md CHANGED
@@ -34,7 +34,7 @@ require 'smart_core'
34
34
 
35
35
  - [Global set of error types](#global-set-of-error-types)
36
36
  - [Simple reentrant lock](#simple-reentrant-lock)
37
- - [Read/Write Lock](#read-write-lock)
37
+ - [Read/Write Lock](#readwrite-lock)
38
38
  - [Cache Storage](#cache-storage)
39
39
  - [Atomic thread-safe value container](#atomic-thread-safe-value-container)
40
40
  - [Any Object Frozener](#any-object-frozener) (classic c-level `frozen?`/`freeze`)
@@ -2,7 +2,7 @@
2
2
 
3
3
  # @api public
4
4
  # @since 0.14.0
5
- # @version 0.15.0
5
+ # @version 0.17.0
6
6
  class SmartCore::Engine::ReadWriteLock
7
7
  # @return [void]
8
8
  #
@@ -21,10 +21,15 @@ class SmartCore::Engine::ReadWriteLock
21
21
  #
22
22
  # @api public
23
23
  # @since 0.14.0
24
+ # @version 0.17.0
24
25
  def read_sync(&block)
25
26
  @active_reader = true
26
- while @write_lock.locked? do; end
27
- yield
27
+ if @write_lock.locked? && @write_lock.owned?
28
+ yield
29
+ else
30
+ while @write_lock.locked? do; end
31
+ yield
32
+ end
28
33
  ensure
29
34
  @active_reader = false
30
35
  end
@@ -6,7 +6,7 @@ module SmartCore
6
6
  #
7
7
  # @api public
8
8
  # @since 0.1.0
9
- # @version 0.16.0
10
- VERSION = '0.16.0'
9
+ # @version 0.17.0
10
+ VERSION = '0.17.0'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-29 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler