A
Ara.T.Howard
what is is the prefered method in which one thread can 'signal' another thread
on some condition? Observable? other?
eg.
other = Thread.new {
do_important_work
}
watch = Thread.new {
loop {
notify(other) if some_test_that_should_interupt_important_work
}
}
one thing i've considered doing is something like
worker = Thread.new{stop; do_work}
watcher = Thread.new{stop; loop{check or worker.stop}}
watcher.start
worker.start
perhaps this model would be best done using another process and signals since
the potential for the watcher to be put to sleep at a critical time is larger
with threads...
thoughts?
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
===============================================================================
on some condition? Observable? other?
eg.
other = Thread.new {
do_important_work
}
watch = Thread.new {
loop {
notify(other) if some_test_that_should_interupt_important_work
}
}
one thing i've considered doing is something like
worker = Thread.new{stop; do_work}
watcher = Thread.new{stop; loop{check or worker.stop}}
watcher.start
worker.start
perhaps this model would be best done using another process and signals since
the potential for the watcher to be put to sleep at a critical time is larger
with threads...
thoughts?
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
===============================================================================