ruby-internal 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,22 @@
|
|
8
8
|
|
9
9
|
#ifdef RUBY_VM
|
10
10
|
|
11
|
+
#ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
|
12
|
+
|
13
|
+
# undef GetThreadPtr
|
14
|
+
# define GetThreadPtr(obj, ptr) \
|
15
|
+
TypedData_Get_Struct((obj), rb_thread_t, p_ruby_threadptr_data_type, (ptr))
|
16
|
+
|
17
|
+
static rb_data_type_t const * p_ruby_threadptr_data_type;
|
18
|
+
|
19
|
+
static void init_ruby_threadptr_data_type()
|
20
|
+
{
|
21
|
+
VALUE thread = rb_thread_current();
|
22
|
+
p_ruby_threadptr_data_type = RTYPEDDATA_TYPE(thread);
|
23
|
+
}
|
24
|
+
|
25
|
+
#endif
|
26
|
+
|
11
27
|
static VALUE rb_cVmControlFrame;
|
12
28
|
|
13
29
|
/* TODO: also defined in control_frame.c */
|
@@ -109,5 +125,9 @@ void Init_thread(void)
|
|
109
125
|
|
110
126
|
rb_define_method(rb_cThread, "cfp", thread_cfp, 0);
|
111
127
|
#endif
|
128
|
+
|
129
|
+
#ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
|
130
|
+
init_ruby_threadptr_data_type();
|
131
|
+
#endif
|
112
132
|
}
|
113
133
|
|
@@ -5,6 +5,22 @@
|
|
5
5
|
|
6
6
|
#include "vm_core.h"
|
7
7
|
|
8
|
+
#ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
|
9
|
+
|
10
|
+
# undef GetThreadPtr
|
11
|
+
# define GetThreadPtr(obj, ptr) \
|
12
|
+
TypedData_Get_Struct((obj), rb_thread_t, p_ruby_threadptr_data_type, (ptr))
|
13
|
+
|
14
|
+
static rb_data_type_t const * p_ruby_threadptr_data_type;
|
15
|
+
|
16
|
+
static void init_ruby_threadptr_data_type()
|
17
|
+
{
|
18
|
+
VALUE thread = rb_thread_current();
|
19
|
+
p_ruby_threadptr_data_type = RTYPEDDATA_TYPE(thread);
|
20
|
+
}
|
21
|
+
|
22
|
+
#endif
|
23
|
+
|
8
24
|
/* TODO: Using this class is dangerous, because the control frame can be
|
9
25
|
* popped but a reference kept around to it. It will still point to
|
10
26
|
* valid memory, but the data itself will be invalid.
|
@@ -199,5 +215,9 @@ void Init_control_frame(void)
|
|
199
215
|
rb_define_method(rb_cVmControlFrame, "method_class", control_frame_method_class, 0);
|
200
216
|
rb_define_method(rb_cVmControlFrame, "prev", control_frame_prev, 0);
|
201
217
|
#endif
|
218
|
+
|
219
|
+
#ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
|
220
|
+
init_ruby_threadptr_data_type();
|
221
|
+
#endif
|
202
222
|
}
|
203
223
|
|
data/test/test_module.rb
CHANGED
data/test/test_thread.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rbconfig'
|
3
|
+
|
4
|
+
dir = File.dirname(__FILE__)
|
5
|
+
$:.unshift(dir) if not $:.include?(dir)
|
6
|
+
$:.unshift("#{dir}/../lib") if not $:.include?("#{dir}/../lib")
|
7
|
+
$:.unshift("#{dir}/../ext") if not $:.include?("#{dir}/../ext")
|
8
|
+
|
9
|
+
require 'internal/thread'
|
10
|
+
|
11
|
+
$stdout.sync = true
|
12
|
+
$stderr.sync = true
|
13
|
+
|
14
|
+
class TC_Thread < Test::Unit::TestCase
|
15
|
+
def test_thread_cfp
|
16
|
+
return if not defined?(RubyVM)
|
17
|
+
|
18
|
+
cfp = Thread.current.cfp
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if __FILE__ == $0 then
|
23
|
+
exit Test::Unit::AutoRunner.run
|
24
|
+
end
|
25
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-internal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubypp
|
@@ -361,6 +361,7 @@ files:
|
|
361
361
|
- test/test_method.rb
|
362
362
|
- test/node_samples.rb
|
363
363
|
- test/test_node.rb
|
364
|
+
- test/test_thread.rb
|
364
365
|
- test/test_module.rb
|
365
366
|
- test/test_dump_class.rb
|
366
367
|
- pre-install.rb
|
@@ -416,5 +417,6 @@ test_files:
|
|
416
417
|
- test/test_helpers.rb
|
417
418
|
- test/test_method.rb
|
418
419
|
- test/test_node.rb
|
420
|
+
- test/test_thread.rb
|
419
421
|
- test/test_module.rb
|
420
422
|
- test/test_dump_class.rb
|