A problem of waitting and printting out message

You are right, but now I try to work this program under linux.
===== Original Message From “Hal E. Fulton” hal9000@hypermetrics.com =====


----- Original Message -----
From: “Reimer Behrends” behrends@cse.msu.edu
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Sunday, September 08, 2002 1:32 AM
Subject: Re: a problem of waitting and printting out message

Maggie Xiao (mxiao@ee.ualberta.ca) wrote:

I should construct a program which should wait for the specified time
and then print out the specified message. Meanwhile control of the
shell should be returned to the user. ie. The program must be
non-blocking. is there any way to construct it in pure ruby way? Or
my only way is to using extending ruby with c?

Is the following what you are looking for?

if fork then

parent process


child process

sleep 10
puts "Now!"

I think Maggie is a Windows user (unless my
memory is wrong). And this solution won’t
work on Windows.

Since leaving the Cygwin DLL behind, we have
lost fork() and popen3 and gained a thread-
related bug that cripples many apps.

Probably one of those situations where you
have to take two steps back in order to
take three steps forward.