⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (762 Bytes)
Bug #4027
» sigchldtest.rb
nagachika (Tomoyuki Chikanaga)
, 11/05/2010 07:39 PM
require
"monitor"
class
Test
include
MonitorMixin
def
initialize
mon_initialize
@cond
=
new_cond
@flag
=
false
@thread
=
nil
end
attr_reader
:flag
def
start
@thread
=
Thread
.
start
do
synchronize
do
while
true
@cond
.
wait_until
{
@flag
}
@flag
=
false
begin
while
true
Process
.
wait
end
rescue
Errno
::
ECHILD
end
end
end
end
end
def
set_signal_handler
Signal
.
trap
(
:CHLD
)
do
synchronize
do
@flag
=
true
@cond
.
signal
end
end
end
end
o
=
Test
.
new
o
.
set_signal_handler
o
.
start
while
true
1000
.
times
do
Process
.
spawn
(
"ls > /dev/null"
)
end
sleep
1
p
o
.
flag
end
« Previous
1
2
Next »
(1-1/2)
Loading...