Ractor.main?

to return the current ractor is the main ractor.
(== `Ractor.current == Ractor.main`)
This commit is contained in:
Koichi Sasada 2024-11-05 03:57:48 +09:00
parent c8297c3eed
commit f0d0c030c0
Notes: git 2024-11-08 09:03:09 +00:00

View File

@ -850,4 +850,11 @@ class Ractor
rb_ractor_self(GET_VM()->ractor.main_ractor); rb_ractor_self(GET_VM()->ractor.main_ractor);
} }
end end
# return true if the current ractor is main ractor
def self.main?
__builtin_cexpr! %q{
GET_VM()->ractor.main_ractor == rb_ec_ractor_ptr(ec)
}
end
end end