Computer Science Canada Fun with multi-threading |
Author: | wtd [ Sat Mar 27, 2004 10:53 am ] | ||
Post subject: | Fun with multi-threading | ||
I've been playing with threads in Ruby (though you can do multi-threading in lots of languages, it's really easy in Ruby), and just found something kind of interesting.
It turns out that the puts method is so fast, that running it in two separate threads the second wrote to standard output before the first even had a chance to add a newline. puts adds a newline if the thing being printed doesn't already end in one. |