gvltest 0.1.0 → 0.2.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: 5688674c565e5193465e8b9aba96a1d5841029f7b44d4892b3e7a32c475400e7
4
- data.tar.gz: d02cc2f5d9baf5fe9d3e1b7964e492b5fc53d9d2ec4ea4445c27b9dd8c92c2e1
3
+ metadata.gz: 24a4699b2118ba2457c7765d1e9460c0e333ef6edee72442ef83c988ab87fc61
4
+ data.tar.gz: 12767cf773794fea581f5eca968304de6c0d5a4cfac54ceda7deb5136fcb6116
5
5
  SHA512:
6
- metadata.gz: 53037d6ab481d4b96bb0c8eb5f4dccc7540121f705da473dde5a7d1d485997113b31a1d173de95e2840f10c579dad652c5e6294b596c1d39c35f13333ee233f3
7
- data.tar.gz: ba2c6750a6445f9c070f7b091c30c8073866167e6fade7e2c80010b007ccc4fed5343da758c537b134460de8fb28e5e035dedc553b4a8511d14f9c72338a4519
6
+ metadata.gz: e039bc89f213882d47834b38f118b6969108842d2f1f7f74c90f11f5bef810b66aafefc234f531dcfebaf92335537b133d29313b967ca27d65829d1cde4b6638
7
+ data.tar.gz: 566fd41089e3a155a8d1f86de05aeeab76aeaea9faa614dcae5d9137c9fd7160c7a0aee9deae8c6bb92f6e98f8956b53d93713a360d65ec8aeb9bd7793bd32e6
@@ -1,11 +1,12 @@
1
1
  #include "gvltest.h"
2
2
 
3
+ #include <ruby/thread.h>
3
4
  #include <time.h>
4
5
  #include <errno.h>
5
6
 
6
- VALUE rb_mGVLTest;
7
+ static VALUE rb_mGVLTest;
7
8
 
8
- VALUE sleep_holding_gvl(VALUE self, VALUE timev) {
9
+ static VALUE sleep_holding_gvl(VALUE self, VALUE timev) {
9
10
  double time = NUM2DBL(timev);
10
11
  unsigned long long int ns = time * 1E9;
11
12
  struct timespec ts = { ns / 1000000000LL, ns % 1000000000LL };
@@ -18,9 +19,19 @@ VALUE sleep_holding_gvl(VALUE self, VALUE timev) {
18
19
  return timev;
19
20
  }
20
21
 
22
+ static void *nop(void *) {
23
+ return NULL;
24
+ }
25
+
26
+ static VALUE nogvl_nop(VALUE self) {
27
+ rb_thread_call_without_gvl(nop, NULL, NULL, NULL);
28
+ return Qnil;
29
+ }
30
+
21
31
  RUBY_FUNC_EXPORTED void
22
32
  Init_gvltest(void)
23
33
  {
24
34
  rb_mGVLTest = rb_define_module("GVLTest");
25
35
  rb_define_singleton_method(rb_mGVLTest, "sleep_holding_gvl", sleep_holding_gvl, 1);
36
+ rb_define_singleton_method(rb_mGVLTest, "nogvl_nop", nogvl_nop, 0);
26
37
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GVLTest
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gvltest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hawthorn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-23 00:00:00.000000000 Z
11
+ date: 2024-05-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Some test methods for experimenting with CRuby's GVL
14
14
  email:
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  requirements: []
52
- rubygems_version: 3.5.3
52
+ rubygems_version: 3.5.9
53
53
  signing_key:
54
54
  specification_version: 4
55
55
  summary: Some test methods for experimenting with CRuby's GVL