threads 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.0pdd.yml +22 -4
- data/.github/workflows/actionlint.yml +43 -0
- data/.github/workflows/codecov.yml +40 -0
- data/.github/workflows/copyrights.yml +32 -0
- data/.github/workflows/markdown-lint.yml +40 -0
- data/.github/workflows/pdd.yml +36 -0
- data/.github/workflows/rake.yml +45 -0
- data/.github/workflows/xcop.yml +32 -0
- data/.github/workflows/yamllint.yml +36 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +29 -3
- data/.rultor.yml +30 -11
- data/Gemfile +9 -1
- data/LICENSE.txt +21 -0
- data/README.md +30 -37
- data/Rakefile +8 -2
- data/lib/threads.rb +39 -15
- data/logo.svg +19 -0
- data/renovate.json +6 -0
- data/test/test__helper.rb +28 -0
- data/test/test_threads.rb +11 -2
- data/threads.gemspec +6 -15
- metadata +22 -82
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f03d782a571ce58ab5bea05173116b3ff67ab2b53aa9f00657541fbbe2b33af
|
4
|
+
data.tar.gz: ed1c06246c1a3d096b6e0f6aed5f88aa1c2328dac5e456b4e616aa16b9b1f865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8254154064db4d867cd33a05531d05929743f061771c53ca063a5419be66ee7bc2c140fc199f3f99ff1519452924da57589ac413476213cb7715b89f593007eb
|
7
|
+
data.tar.gz: 0aa17582b6df265ee702ff103d1f74539a3eae2e92706eac835ed95fc1887fae7480b87da6b32201fadcf028d6b3246545e698f34a08df6ed3890a9aa5496315
|
data/.0pdd.yml
CHANGED
@@ -1,9 +1,27 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
1
23
|
errors:
|
2
24
|
- yegor256@gmail.com
|
3
|
-
# alerts:
|
4
|
-
# github:
|
5
|
-
# - yegor256
|
6
|
-
|
7
25
|
tags:
|
8
26
|
- pdd
|
9
27
|
- bug
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: actionlint
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
jobs:
|
32
|
+
actionlint:
|
33
|
+
runs-on: ubuntu-24.04
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v4
|
36
|
+
- name: Download actionlint
|
37
|
+
id: get_actionlint
|
38
|
+
# yamllint disable-line rule:line-length
|
39
|
+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
40
|
+
shell: bash
|
41
|
+
- name: Check workflow files
|
42
|
+
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
43
|
+
shell: bash
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: codecov
|
24
|
+
on:
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
jobs:
|
29
|
+
codecov:
|
30
|
+
runs-on: ubuntu-24.04
|
31
|
+
steps:
|
32
|
+
- uses: actions/checkout@v4
|
33
|
+
- uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: 2.7
|
36
|
+
- run: bundle update
|
37
|
+
- run: bundle exec rake
|
38
|
+
- uses: codecov/codecov-action@v5
|
39
|
+
with:
|
40
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: copyrights
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
pull_request:
|
27
|
+
jobs:
|
28
|
+
copyrights:
|
29
|
+
runs-on: ubuntu-24.04
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v4
|
32
|
+
- uses: yegor256/copyrights-action@0.0.8
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: markdown-lint
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
paths-ignore: ['paper/**', 'sandbox/**']
|
32
|
+
concurrency:
|
33
|
+
group: markdown-lint-${{ github.ref }}
|
34
|
+
cancel-in-progress: true
|
35
|
+
jobs:
|
36
|
+
markdown-lint:
|
37
|
+
runs-on: ubuntu-24.04
|
38
|
+
steps:
|
39
|
+
- uses: actions/checkout@v4
|
40
|
+
- uses: articulate/actions-markdownlint@v1
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: pdd
|
24
|
+
on:
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
jobs:
|
32
|
+
pdd:
|
33
|
+
runs-on: ubuntu-24.04
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v4
|
36
|
+
- uses: volodya-lombrozo/pdd-action@master
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: rake
|
24
|
+
on:
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
jobs:
|
32
|
+
test:
|
33
|
+
name: test
|
34
|
+
strategy:
|
35
|
+
matrix:
|
36
|
+
os: [ubuntu-24.04, macos-15]
|
37
|
+
ruby: [2.7, 3.3]
|
38
|
+
runs-on: ${{ matrix.os }}
|
39
|
+
steps:
|
40
|
+
- uses: actions/checkout@v4
|
41
|
+
- uses: ruby/setup-ruby@v1
|
42
|
+
with:
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
44
|
+
- run: bundle update
|
45
|
+
- run: bundle exec rake
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: xcop
|
24
|
+
on:
|
25
|
+
push:
|
26
|
+
pull_request:
|
27
|
+
jobs:
|
28
|
+
xcop:
|
29
|
+
runs-on: ubuntu-24.04
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v4
|
32
|
+
- uses: g4s8/xcop-action@master
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: yamllint
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
jobs:
|
32
|
+
yamllint:
|
33
|
+
runs-on: ubuntu-24.04
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v4
|
36
|
+
- uses: ibiqlik/action-yamllint@v3
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,10 +1,36 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
1
23
|
AllCops:
|
2
24
|
DisplayCopNames: true
|
3
25
|
TargetRubyVersion: 2.3.3
|
26
|
+
NewCops: enable
|
27
|
+
SuggestExtensions: false
|
4
28
|
|
5
|
-
Layout/MultilineMethodCallIndentation:
|
6
|
-
Enabled: false
|
7
29
|
Metrics/AbcSize:
|
8
|
-
Max:
|
30
|
+
Max: 50
|
9
31
|
Metrics/MethodLength:
|
32
|
+
Max: 50
|
33
|
+
Metrics/BlockLength:
|
10
34
|
Max: 30
|
35
|
+
Layout/EmptyLineAfterGuardClause:
|
36
|
+
Enabled: false
|
data/.rultor.yml
CHANGED
@@ -1,12 +1,35 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
docker:
|
24
|
+
image: yegor256/rultor-ruby
|
1
25
|
assets:
|
2
|
-
rubygems.yml:
|
26
|
+
rubygems.yml: yegor256/home#assets/rubygems.yml
|
3
27
|
install: |-
|
4
|
-
|
5
|
-
|
28
|
+
sudo chown -R "$(whoami)" /usr/local/rvm
|
29
|
+
bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
6
30
|
release:
|
7
31
|
script: |-
|
8
|
-
bundle
|
9
|
-
rake
|
32
|
+
bundle exec rake
|
10
33
|
rm -rf *.gem
|
11
34
|
sed -i "s/0\.0\.0/${tag}/g" threads.gemspec
|
12
35
|
git add threads.gemspec
|
@@ -14,10 +37,6 @@ release:
|
|
14
37
|
gem build threads.gemspec
|
15
38
|
chmod 0600 ../rubygems.yml
|
16
39
|
gem push *.gem --config-file ../rubygems.yml
|
17
|
-
commanders:
|
18
|
-
- yegor256
|
19
|
-
architect:
|
20
|
-
- yegor256
|
21
40
|
merge:
|
22
|
-
|
23
|
-
|
41
|
+
script: |-
|
42
|
+
bundle exec rake
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -22,3 +22,11 @@
|
|
22
22
|
|
23
23
|
source 'https://rubygems.org'
|
24
24
|
gemspec
|
25
|
+
|
26
|
+
gem 'minitest', '~>5', require: false
|
27
|
+
gem 'rake', '13.2.1', require: false
|
28
|
+
gem 'rdoc', '6.10.0', require: false
|
29
|
+
gem 'rubocop', '1.69.2', require: false
|
30
|
+
gem 'rubocop-rspec', '3.3.0', require: false
|
31
|
+
gem 'simplecov', '0.22.0', require: false
|
32
|
+
gem 'yard', '0.9.37', require: false
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018-2024 Yegor Bugayenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included
|
13
|
+
in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,22 +1,33 @@
|
|
1
|
+
# Runs Code Block in Many Threads
|
2
|
+
|
3
|
+
[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
|
1
4
|
[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/threads)](http://www.rultor.com/p/yegor256/threads)
|
2
|
-
[![We recommend RubyMine](
|
5
|
+
[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
|
3
6
|
|
4
|
-
[![
|
7
|
+
[![rake](https://github.com/yegor256/threads/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/threads/actions/workflows/rake.yml)
|
5
8
|
[![Gem Version](https://badge.fury.io/rb/threads.svg)](http://badge.fury.io/rb/threads)
|
6
9
|
[![Maintainability](https://api.codeclimate.com/v1/badges/24fc3acdf781d98b8749/maintainability)](https://codeclimate.com/github/yegor256/threads/maintainability)
|
10
|
+
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/threads/master/frames)
|
11
|
+
[![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/threads.svg)](https://codecov.io/github/yegor256/threads?branch=master)
|
12
|
+
[![Hits-of-Code](https://hitsofcode.com/github/yegor256/threads)](https://hitsofcode.com/view/github/yegor256/threads)
|
13
|
+
|
14
|
+
Read this blog post first: [Do You Test Ruby Code for Thread Safety?][blog]
|
7
15
|
|
8
16
|
When you need to test your code for thread safety, what do you do?
|
9
17
|
That's right, you just don't test it.
|
10
|
-
That's
|
11
|
-
|
18
|
+
That's
|
19
|
+
[wrong](https://www.yegor256.com/2018/03/27/how-to-test-thread-safety.html)!
|
20
|
+
This simple gem helps you test your code
|
21
|
+
with just two additional lines of code.
|
12
22
|
|
13
23
|
First, install it:
|
14
24
|
|
15
25
|
```bash
|
16
|
-
|
26
|
+
gem install threads
|
17
27
|
```
|
18
28
|
|
19
|
-
Then, use it like this, to test your code from multiple
|
29
|
+
Then, use it like this, to test your code from multiple
|
30
|
+
concurrently running threads:
|
20
31
|
|
21
32
|
```ruby
|
22
33
|
require 'threads'
|
@@ -25,9 +36,11 @@ Threads.new(5).assert do |i|
|
|
25
36
|
end
|
26
37
|
```
|
27
38
|
|
28
|
-
You can put whatever you want into the block. The code will be executed
|
39
|
+
You can put whatever you want into the block. The code will be executed
|
40
|
+
from five threads, concurrently.
|
29
41
|
You can also make sure the code block runs only a specific number of times
|
30
|
-
specifying the argument in the `assert` method (it can't be smaller
|
42
|
+
specifying the argument in the `assert` method (it can't be smaller
|
43
|
+
than the amount of threads):
|
31
44
|
|
32
45
|
```ruby
|
33
46
|
Threads.new(5).assert(20) do |i, r|
|
@@ -46,40 +59,20 @@ end
|
|
46
59
|
|
47
60
|
That's it.
|
48
61
|
|
49
|
-
|
62
|
+
## How to contribute
|
50
63
|
|
51
|
-
Read
|
64
|
+
Read
|
65
|
+
[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
52
66
|
Make sure you build is green before you contribute
|
53
|
-
your pull request. You will need to have
|
67
|
+
your pull request. You will need to have
|
68
|
+
[Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
54
69
|
[Bundler](https://bundler.io/) installed. Then:
|
55
70
|
|
56
|
-
```
|
57
|
-
|
58
|
-
|
71
|
+
```bash
|
72
|
+
bundle update
|
73
|
+
bundle exec rake
|
59
74
|
```
|
60
75
|
|
61
76
|
If it's clean and you don't see any error messages, submit your pull request.
|
62
77
|
|
63
|
-
|
64
|
-
|
65
|
-
(The MIT License)
|
66
|
-
|
67
|
-
Copyright (c) 2018 Yegor Bugayenko
|
68
|
-
|
69
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
70
|
-
of this software and associated documentation files (the 'Software'), to deal
|
71
|
-
in the Software without restriction, including without limitation the rights
|
72
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
73
|
-
copies of the Software, and to permit persons to whom the Software is
|
74
|
-
furnished to do so, subject to the following conditions:
|
75
|
-
|
76
|
-
The above copyright notice and this permission notice shall be included in all
|
77
|
-
copies or substantial portions of the Software.
|
78
|
-
|
79
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
80
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
81
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
82
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
83
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
84
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
85
|
-
SOFTWARE.
|
78
|
+
[blog]: https://www.yegor256.com/2018/11/06/ruby-threads.html
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -34,7 +34,7 @@ def version
|
|
34
34
|
Gem::Specification.load(Dir['*.gemspec'].first).version
|
35
35
|
end
|
36
36
|
|
37
|
-
task default: %i[clean test rubocop]
|
37
|
+
task default: %i[clean test rubocop yard]
|
38
38
|
|
39
39
|
require 'rake/testtask'
|
40
40
|
desc 'Run all unit tests'
|
@@ -44,6 +44,12 @@ Rake::TestTask.new(:test) do |test|
|
|
44
44
|
test.verbose = false
|
45
45
|
end
|
46
46
|
|
47
|
+
require 'yard'
|
48
|
+
desc 'Build Yard documentation'
|
49
|
+
YARD::Rake::YardocTask.new do |t|
|
50
|
+
t.files = ['lib/**/*.rb']
|
51
|
+
end
|
52
|
+
|
47
53
|
require 'rubocop/rake_task'
|
48
54
|
desc 'Run RuboCop on all directories'
|
49
55
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
data/lib/threads.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -26,11 +26,27 @@ require 'concurrent'
|
|
26
26
|
require 'backtrace'
|
27
27
|
|
28
28
|
# Threads.
|
29
|
+
#
|
30
|
+
# This class may help you test your code for thread-safety by running
|
31
|
+
# it multiple times in a few parallel threads:
|
32
|
+
#
|
33
|
+
# require 'threads'
|
34
|
+
# Threads.new(5).assert do |i|
|
35
|
+
# puts "Hello from the thread no.#{i}"
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# Here, the message will be printed to the console five times, once in every
|
39
|
+
# thread.
|
40
|
+
#
|
29
41
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
-
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
|
42
|
+
# Copyright:: Copyright (c) 2018-2024 Yegor Bugayenko
|
31
43
|
# License:: MIT
|
32
44
|
class Threads
|
33
|
-
|
45
|
+
# Constructor.
|
46
|
+
#
|
47
|
+
# @param [Number] total How many threads to run
|
48
|
+
# @param [Logger] log Where to print output
|
49
|
+
def initialize(total = Concurrent.processor_count * 8, log: $stdout)
|
34
50
|
raise "Total can't be nil" if total.nil?
|
35
51
|
raise "Total can't be negative or zero: #{total}" unless total.positive?
|
36
52
|
@total = total
|
@@ -38,32 +54,40 @@ class Threads
|
|
38
54
|
@log = log
|
39
55
|
end
|
40
56
|
|
57
|
+
# Run them all and assert that all of them finished successfully.
|
58
|
+
#
|
59
|
+
# @param [Number] reps How many times to repeat the testing cycle
|
60
|
+
# @return nil
|
41
61
|
def assert(reps = @total)
|
42
|
-
if reps < @total
|
43
|
-
raise "Repetition counter #{reps} can't be smaller than #{@total}"
|
44
|
-
end
|
62
|
+
raise "Repetition counter #{reps} can't be smaller than #{@total}" if reps < @total
|
45
63
|
done = Concurrent::AtomicFixnum.new
|
46
64
|
rep = Concurrent::AtomicFixnum.new
|
47
65
|
pool = Concurrent::FixedThreadPool.new(@total)
|
48
66
|
latch = Concurrent::CountDownLatch.new(1)
|
67
|
+
finish = Concurrent::CountDownLatch.new(@total)
|
49
68
|
@total.times do |t|
|
50
69
|
pool.post do
|
51
70
|
Thread.current.name = "assert-thread-#{t}"
|
52
71
|
latch.wait(10)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
72
|
+
begin
|
73
|
+
loop do
|
74
|
+
r = rep.increment
|
75
|
+
break if r > reps
|
76
|
+
begin
|
77
|
+
yield(t, r - 1)
|
78
|
+
rescue StandardError => e
|
79
|
+
print(Backtrace.new(e))
|
80
|
+
raise e
|
81
|
+
end
|
61
82
|
end
|
83
|
+
done.increment
|
84
|
+
ensure
|
85
|
+
finish.count_down
|
62
86
|
end
|
63
|
-
done.increment
|
64
87
|
end
|
65
88
|
end
|
66
89
|
latch.count_down
|
90
|
+
finish.wait(10)
|
67
91
|
pool.shutdown
|
68
92
|
raise "Can't stop the pool" unless pool.wait_for_termination(30)
|
69
93
|
return if done.value == @total
|
data/logo.svg
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<svg width="314px" height="314px" viewBox="0 0 314 314" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
+
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
|
4
|
+
<title>Group 2</title>
|
5
|
+
<desc>Created with Sketch.</desc>
|
6
|
+
<defs></defs>
|
7
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8
|
+
<g id="Group-2">
|
9
|
+
<g id="Group">
|
10
|
+
<circle id="Oval" fill="#053C5E" cx="157" cy="157" r="157"></circle>
|
11
|
+
<rect id="Rectangle" fill="#2B2B2B" x="0" y="234" width="267" height="68"></rect>
|
12
|
+
<text id="threads" font-family="CourierNewPS-BoldMT, Courier New" font-size="50" font-weight="bold" fill="#FFFFFF">
|
13
|
+
<tspan x="28" y="282">threads</tspan>
|
14
|
+
</text>
|
15
|
+
<path d="M135.676765,111.215287 C135.211714,113.540467 132.770932,120.688823 130.252813,127.100603 C127.734621,133.512383 125.2898,140.431445 124.819828,142.476214 C123.6868,147.405663 121.517836,147.185477 119.69487,141.95608 C116.899865,133.938362 105.171362,111.043501 103.859129,111.043501 C100.420089,111.043501 101.508757,114.986149 109.1771,130.30227 C113.739327,139.414532 118.032086,147.448041 118.716515,148.15443 C120.694817,150.196115 120.172626,154.319657 117.358599,158.877992 C113.567467,165.019055 107.570942,183.721189 108.054206,187.896804 C108.804956,194.383204 112.436054,192.210274 113.355359,184.724515 C114.48376,175.535577 120.945556,159.641154 124.897459,156.333653 C127.109021,154.482778 128.268636,151.905536 128.573284,148.163978 C128.818001,145.157747 131.906711,135.560972 135.437115,126.837819 C138.96752,118.114666 141.511492,110.079835 141.090434,108.982574 C139.755727,105.504315 136.554941,106.824333 135.676765,111.215287 M174.714659,126.841564 C169.37392,129.699438 169.197653,130.049915 167.452978,141.283475 C165.577352,153.360398 165.225112,168.513913 166.548289,180.203784 L167.566817,189.202501 L161.346213,191.9541 C154.601949,194.937416 150.91195,200.302465 153.156708,203.861146 C155.104824,206.949562 157.09025,206.70198 157.571826,203.310532 C158.083734,199.706169 166.097413,193.204052 170.29418,192.987978 C172.116999,192.894116 173.522874,191.717021 173.97823,189.903529 C174.383277,188.290613 177.740353,184.944554 181.438431,182.467858 C188.546172,177.707551 194.317883,170.450278 194.317883,166.273341 C194.317883,162.684548 189.493165,158.361603 185.487795,158.361603 C180.701636,158.361603 180.027195,155.239403 183.731222,150.229385 C188.308065,144.038966 188.284856,130.867646 183.690534,127.147387 C179.896537,124.075276 179.885006,124.074836 174.714659,126.841564 M182.67318,134.240439 C184.752542,140.153164 174.808961,161.185104 171.588639,157.68562 C169.868715,155.81653 172.863122,135.012708 175.266374,132.134564 C177.872553,129.013319 181.163896,129.949075 182.67318,134.240439 M184.854262,162.269586 C190.589839,163.855621 189.673839,167.881335 181.645765,176.371155 C177.281618,180.986262 173.904933,183.573859 173.371946,182.711474 C172.876636,181.91012 172.127869,176.711937 171.707987,171.159972 L170.944531,161.065463 L176.209475,161.200234 C179.105172,161.274339 182.995308,161.755548 184.854262,162.269586 M132.642184,172.492256 C131.593837,175.224098 133.152917,177.288844 136.264027,177.288844 C139.014965,177.288844 139.431396,176.221769 138.067531,172.667568 C137.039234,169.987871 133.645289,169.878218 132.642184,172.492256 M203.781503,185.840798 C203.781503,187.657595 209.264724,193.512152 210.966361,193.512152 C212.534035,193.512152 211.991059,187.391138 210.270768,185.670847 C208.092403,183.492409 203.781503,183.605293 203.781503,185.840798" id="Fill-6" fill="#427B8A" fill-rule="nonzero"></path>
|
16
|
+
</g>
|
17
|
+
</g>
|
18
|
+
</g>
|
19
|
+
</svg>
|
data/renovate.json
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
$stdout.sync = true
|
26
|
+
|
27
|
+
require 'simplecov'
|
28
|
+
SimpleCov.start
|
data/test/test_threads.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../lib/threads'
|
|
28
28
|
|
29
29
|
# Threads test.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2018-2024 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class ThreadsTest < Minitest::Test
|
34
34
|
def test_multiple_threads
|
@@ -47,6 +47,15 @@ class ThreadsTest < Minitest::Test
|
|
47
47
|
assert_equal(20, done.value)
|
48
48
|
end
|
49
49
|
|
50
|
+
def test_slow_threads
|
51
|
+
done = Concurrent::AtomicFixnum.new
|
52
|
+
Threads.new(3).assert(20) do
|
53
|
+
sleep(0.1)
|
54
|
+
done.increment
|
55
|
+
end
|
56
|
+
assert_equal(20, done.value)
|
57
|
+
end
|
58
|
+
|
50
59
|
def test_multiple_threads_with_errors
|
51
60
|
log = FakeLog.new
|
52
61
|
assert_raises do
|
data/threads.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2018 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2018-2024 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,14 +24,10 @@
|
|
24
24
|
|
25
25
|
require 'English'
|
26
26
|
Gem::Specification.new do |s|
|
27
|
-
s.
|
28
|
-
if s.respond_to? :required_rubygems_version=
|
29
|
-
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
30
|
-
end
|
31
|
-
s.rubygems_version = '2.3.3'
|
27
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
32
28
|
s.required_ruby_version = '>=2.3'
|
33
29
|
s.name = 'threads'
|
34
|
-
s.version = '0.
|
30
|
+
s.version = '0.4.1'
|
35
31
|
s.license = 'MIT'
|
36
32
|
s.summary = 'Test threads'
|
37
33
|
s.description = 'Rugy Gem to test a piece of code in concurrent threads'
|
@@ -39,14 +35,9 @@ Gem::Specification.new do |s|
|
|
39
35
|
s.email = 'yegor256@gmail.com'
|
40
36
|
s.homepage = 'http://github.com/yegor256/threads'
|
41
37
|
s.files = `git ls-files`.split($RS)
|
42
|
-
s.test_files = s.files.grep(%r{^(test)/})
|
43
38
|
s.rdoc_options = ['--charset=UTF-8']
|
44
39
|
s.extra_rdoc_files = ['README.md']
|
45
|
-
s.
|
46
|
-
s.
|
47
|
-
s.
|
48
|
-
s.add_development_dependency 'rake', '~>12'
|
49
|
-
s.add_development_dependency 'rdoc', '~>4'
|
50
|
-
s.add_development_dependency 'rubocop', '0.58.1'
|
51
|
-
s.add_development_dependency 'rubocop-rspec', '~>1'
|
40
|
+
s.add_dependency 'backtrace', '~>0'
|
41
|
+
s.add_dependency 'concurrent-ruby', '~>1.0'
|
42
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
52
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: threads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -38,76 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '5'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '5'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '12'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '12'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rdoc
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '4'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '4'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - '='
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.58.1
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - '='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.58.1
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '1'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '1'
|
111
41
|
description: Rugy Gem to test a piece of code in concurrent threads
|
112
42
|
email: yegor256@gmail.com
|
113
43
|
executables: []
|
@@ -116,22 +46,34 @@ extra_rdoc_files:
|
|
116
46
|
- README.md
|
117
47
|
files:
|
118
48
|
- ".0pdd.yml"
|
49
|
+
- ".github/workflows/actionlint.yml"
|
50
|
+
- ".github/workflows/codecov.yml"
|
51
|
+
- ".github/workflows/copyrights.yml"
|
52
|
+
- ".github/workflows/markdown-lint.yml"
|
53
|
+
- ".github/workflows/pdd.yml"
|
54
|
+
- ".github/workflows/rake.yml"
|
55
|
+
- ".github/workflows/xcop.yml"
|
56
|
+
- ".github/workflows/yamllint.yml"
|
119
57
|
- ".gitignore"
|
120
58
|
- ".pdd"
|
121
59
|
- ".rubocop.yml"
|
122
60
|
- ".rultor.yml"
|
123
|
-
- ".travis.yml"
|
124
61
|
- Gemfile
|
62
|
+
- LICENSE.txt
|
125
63
|
- README.md
|
126
64
|
- Rakefile
|
127
65
|
- lib/threads.rb
|
66
|
+
- logo.svg
|
67
|
+
- renovate.json
|
68
|
+
- test/test__helper.rb
|
128
69
|
- test/test_threads.rb
|
129
70
|
- threads.gemspec
|
130
71
|
homepage: http://github.com/yegor256/threads
|
131
72
|
licenses:
|
132
73
|
- MIT
|
133
|
-
metadata:
|
134
|
-
|
74
|
+
metadata:
|
75
|
+
rubygems_mfa_required: 'true'
|
76
|
+
post_install_message:
|
135
77
|
rdoc_options:
|
136
78
|
- "--charset=UTF-8"
|
137
79
|
require_paths:
|
@@ -147,10 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
89
|
- !ruby/object:Gem::Version
|
148
90
|
version: '0'
|
149
91
|
requirements: []
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
specification_version: 2
|
92
|
+
rubygems_version: 3.4.10
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
154
95
|
summary: Test threads
|
155
|
-
test_files:
|
156
|
-
- test/test_threads.rb
|
96
|
+
test_files: []
|