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 +4 -4
- data/ext/gvltest/gvltest.c +13 -2
- data/lib/gvltest/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24a4699b2118ba2457c7765d1e9460c0e333ef6edee72442ef83c988ab87fc61
|
4
|
+
data.tar.gz: 12767cf773794fea581f5eca968304de6c0d5a4cfac54ceda7deb5136fcb6116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e039bc89f213882d47834b38f118b6969108842d2f1f7f74c90f11f5bef810b66aafefc234f531dcfebaf92335537b133d29313b967ca27d65829d1cde4b6638
|
7
|
+
data.tar.gz: 566fd41089e3a155a8d1f86de05aeeab76aeaea9faa614dcae5d9137c9fd7160c7a0aee9deae8c6bb92f6e98f8956b53d93713a360d65ec8aeb9bd7793bd32e6
|
data/ext/gvltest/gvltest.c
CHANGED
@@ -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
|
}
|
data/lib/gvltest/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|