Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Trying to work with Threads

Reply
Thread Tools

Trying to work with Threads

 
 
|MKSM|
Guest
Posts: n/a
 
      09-05-2006
Hello,

I was doing a quick test with Threads in my Win32 box and something
strange occured. The point here is to input text without interrupting
the counter. I plan to use a similar method to display text incoming
from a server while being able to send messages and such. A couple of
people told me that it works ok on *nix, but I can't get it to work
here.

The code:

t1 = Thread.new {
x=0
loop do
puts x
x+=1
sleep(1)
end
}

t2 = Thread.new {
loop do
y = gets.chomp
puts y
end
}


t1.join
t2.join

Regards,

Ricardo Amorim

 
Reply With Quote
 
 
 
 
Heesob Park
Guest
Posts: n/a
 
      09-05-2006
Hi,

|MKSM| wrote:
> Hello,
>
> I was doing a quick test with Threads in my Win32 box and something
> strange occured. The point here is to input text without interrupting
> the counter. I plan to use a similar method to display text incoming
> from a server while being able to send messages and such. A couple of
> people told me that it works ok on *nix, but I can't get it to work
> here.
>
> The code:
>
> t1 = Thread.new {
> x=0
> loop do
> puts x
> x+=1
> sleep(1)
> end
> }
>
> t2 = Thread.new {
> loop do
> y = gets.chomp
> puts y
> end
> }
>
>
> t1.join
> t2.join
>
> Regards,
>
> Ricardo Amorim


This is a well-known win32 bug.
Though I had tried to fix the bug about 3 years ago, it was not
accepted.
Refer to
http://groups.google.co.kr/group/com...7702b046d0a31/
for more detail.

Regards,

Park Heesob


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Threads - Get running threads Pedro Pinto Java 2 04-08-2008 11:44 PM
[new to threads] threads with UI and loop Une bévue Ruby 0 06-14-2006 10:22 AM
TB View, Threads, Threads with unread The Invisible Man Firefox 1 03-20-2006 02:09 AM
Standard Threads vs Weightless Threads yoda Python 2 08-01-2005 09:12 PM
threads without threads sindica@gmail.com C Programming 4 08-27-2004 09:25 PM



Advertisments