Re: threads not executing @ same time




I haven't read your code in great detail or even tried to run it. What
caught my eye immediately was that you're joining your threads. When
you call join() on a thread, it causes the current thread to wait for
that thread to finish executing before continuing. If you want them to
run in "parallel" you'll want to use detatch() instead, as in:

$thread = threads->create(\&speak_arr, $u, @arr);
$thread->detach();


Ralph,

Thanks, I did try detach and they do execute @ the same time but then
this situation occurs:

Each thread prints the 1st part of the array sent, then waits for input
newline input on the socket. So unless some1 is typing the threads halt
on the sleep command.
Without sleep command they flood and exit.

.