Ractor.allocate should not be allowed
Ractor.allocate and Ractor#dup should not be allowed like Thread. [Bug #17642]
This commit is contained in:
parent
9a5da2dcff
commit
7b9476fbfa
Notes:
git
2021-02-18 22:35:57 +09:00
@ -8,6 +8,24 @@ assert_equal 'Ractor', %q{
|
|||||||
Ractor.new{}.class
|
Ractor.new{}.class
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ractor.allocate is not supported
|
||||||
|
assert_equal "[:ok, :ok]", %q{
|
||||||
|
rs = []
|
||||||
|
begin
|
||||||
|
Ractor.allocate
|
||||||
|
rescue => e
|
||||||
|
rs << :ok if e.message == 'allocator undefined for Ractor'
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
Ractor.new{}.dup
|
||||||
|
rescue
|
||||||
|
rs << :ok if e.message == 'allocator undefined for Ractor'
|
||||||
|
end
|
||||||
|
|
||||||
|
rs
|
||||||
|
}
|
||||||
|
|
||||||
# A Ractor can have a name
|
# A Ractor can have a name
|
||||||
assert_equal 'test-name', %q{
|
assert_equal 'test-name', %q{
|
||||||
r = Ractor.new name: 'test-name' do
|
r = Ractor.new name: 'test-name' do
|
||||||
|
2
ractor.c
2
ractor.c
@ -2088,6 +2088,8 @@ void
|
|||||||
Init_Ractor(void)
|
Init_Ractor(void)
|
||||||
{
|
{
|
||||||
rb_cRactor = rb_define_class("Ractor", rb_cObject);
|
rb_cRactor = rb_define_class("Ractor", rb_cObject);
|
||||||
|
rb_undef_alloc_func(rb_cRactor);
|
||||||
|
|
||||||
rb_eRactorError = rb_define_class_under(rb_cRactor, "Error", rb_eRuntimeError);
|
rb_eRactorError = rb_define_class_under(rb_cRactor, "Error", rb_eRuntimeError);
|
||||||
rb_eRactorIsolationError = rb_define_class_under(rb_cRactor, "IsolationError", rb_eRactorError);
|
rb_eRactorIsolationError = rb_define_class_under(rb_cRactor, "IsolationError", rb_eRactorError);
|
||||||
rb_eRactorRemoteError = rb_define_class_under(rb_cRactor, "RemoteError", rb_eRactorError);
|
rb_eRactorRemoteError = rb_define_class_under(rb_cRactor, "RemoteError", rb_eRactorError);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user