From: Walle Wallen Date: 2010-05-26T19:07:24+09:00 Subject: how to achieve parallelism, using threads? Hey, I'm having a hard time figuring out how threads works, and how to use them. I'm currently working on a project were I need to achieve parallelism in the code, but I always ends up with a multiply threads, working in a queue (after each other, as a single thread program). If we take a look at the code example bellow. What I'm trying to achieve is the following. The main loop starts a new thread, executes it and then CONTINUES, without waiting for the thread to finish. They should work simultaneously. The problem is, they don't. So, I tried executing the thread without using join. But it crashed the program since the thread didn't have time to finish. Can someone please help me? //Walle Example code def func() #Tcp connection and more end def main_loop() #do some work aThread = Thread.new {func()} aThread.join end main_loop() -- Posted via http://www.ruby-forum.com/.