A
Ara.T.Howard
under which conditions will a blocking operation in a thread block the entire
process?
i thought i understood this but was suprised that
~ > ruby -e 'Thread.new{gets}; Thread.new{select nil}; Thread.new{puts 42}'
42
does not seem to block the entire process.
i also was suprised that this worked:
~ > printf "4\n2\n" | ruby -e '[Thread.new{p gets.chop},Thread.new{p
gets.chop}].map{|t| t.join}'
"4"
"2"
i have been in situations before where one thread blocking has blocked my
entire application and remember thinking to myself - "don't do blocking i/o
from threads". but that appears to be too strong of a statement.
can someone concisely enumerate the things to avoid?
regards.
-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
===============================================================================
process?
i thought i understood this but was suprised that
~ > ruby -e 'Thread.new{gets}; Thread.new{select nil}; Thread.new{puts 42}'
42
does not seem to block the entire process.
i also was suprised that this worked:
~ > printf "4\n2\n" | ruby -e '[Thread.new{p gets.chop},Thread.new{p
gets.chop}].map{|t| t.join}'
"4"
"2"
i have been in situations before where one thread blocking has blocked my
entire application and remember thinking to myself - "don't do blocking i/o
from threads". but that appears to be too strong of a statement.
can someone concisely enumerate the things to avoid?
regards.
-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
===============================================================================