diff options
author | Quang-Minh Nguyen <[email protected]> | 2020-09-18 12:15:32 +0700 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-09-20 23:10:44 +0900 |
commit | d5fa66156ab116df558448402b93c9c129b30291 (patch) | |
tree | 0a2d12b7d8628f680a6ed9d8be160fc0b7bced20 /ractor.rb | |
parent | 84c4c7bec8f17081bc59e5447e2101ffc884fb2f (diff) |
Add status to Ractor#inspect
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3555
Diffstat (limited to 'ractor.rb')
-rw-r--r-- | ractor.rb | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -12,7 +12,7 @@ class Ractor # receive them. # # The result of the block is sent via the outgoing channel - # and other + # and other # # r = Ractor.new do # Ractor.recv # recv via r's mailbox => 1 @@ -29,7 +29,7 @@ class Ractor # # other options: # name: Ractor's name - # + # def self.new *args, name: nil, &block b = block # TODO: builtin bug raise ArgumentError, "must be called with a block" unless block @@ -132,7 +132,10 @@ class Ractor loc = __builtin_cexpr! %q{ RACTOR_PTR(self)->loc } name = __builtin_cexpr! %q{ RACTOR_PTR(self)->name } id = __builtin_cexpr! %q{ INT2FIX(RACTOR_PTR(self)->id) } - "#<Ractor:##{id}#{name ? ' '+name : ''}#{loc ? " " + loc : ''}>" + status = __builtin_cexpr! %q{ + rb_str_new2(ractor_status_str(RACTOR_PTR(self)->status_)) + } + "#<Ractor:##{id}#{name ? ' '+name : ''}#{loc ? " " + loc : ''} #{status}>" end def name |