[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04002] Re: Thread and File do not work together

From: matz@... (Yukihiro Matsumoto)
Date: 2000-07-14 06:28:52 UTC
List: ruby-talk #4002
Hi,

In message "[ruby-talk:03971] Thread and File do not work together"
    on 00/07/13, "Michael Neumann" <neumann@s-direktnet.de> writes:

|following example do not work correctly with my ruby 
|(ruby 1.4.5 (2000-06-26) [i386-mswin32])

Finally, I got it.

|Thread.start {
|   print "ok\n"
|   print File::readlines("index.htm").to_s  
|}
|readline
|
|It prints "ok" but nothing else.
|If I comment out the "Thread.start {", then it works.
|
|What's wrong?

Thread.start creates new thread and fork it, then readline meets EOF
and raise error in the main thread.  When the main thread terminates
whole process (including forked thread) be terminated too.

  Thread.start {
     print "ok\n"
     print File::readlines("index.htm").to_s  
  }.join
  readline

will change the situation.

							matz.

In This Thread