Class: Async::Container::Thread::Instance
Constant Summary
Constants inherited
from Notify::Pipe
Notify::Pipe::NOTIFY_PIPE
Class Method Summary
collapse
Instance Method Summary
collapse
#before_spawn, open!, #ready!, #reloading!, #restarting!, #send
#error!, #ready!, #reloading!, #restarting!, #status!, #stopping!
Constructor Details
#initialize(io) ⇒ Instance
Returns a new instance of Instance.
52
53
54
55
56
57
|
# File 'lib/async/container/thread.rb', line 52
def initialize(io)
@name = nil
@thread = ::Thread.current
super
end
|
Class Method Details
.for(thread) ⇒ Object
46
47
48
49
50
|
# File 'lib/async/container/thread.rb', line 46
def self.for(thread)
instance = self.new(thread.out)
return instance
end
|
Instance Method Details
#exec(*arguments, ready: true, **options) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/async/container/thread.rb', line 67
def exec(*arguments, ready: true, **options)
if ready
self.ready!(status: "(spawn)") if ready
else
self.before_spawn(arguments, options)
end
begin
pid = ::Process.spawn(*arguments, options)
ensure
_, status = ::Process.wait2(pid)
raise Exit, status
end
end
|
#name ⇒ Object
63
64
65
|
# File 'lib/async/container/thread.rb', line 63
def name
@thread.name
end
|
#name=(value) ⇒ Object
59
60
61
|
# File 'lib/async/container/thread.rb', line 59
def name= value
@thread.name = value
end
|