in reply to Re^2: multithreading sample needed
in thread multithreading sample needed

Perhaps you'll find this a more convincing demonstration of concurrency?

Each of four threads continuously prints its own thread id (a number from 1.. 4) to the screen; while the 5th (main) thread waits for you to hit enter:

perl -Mthreads -e"$|++;async{print threads->tid while 1}->detach for 1 + .. 4; <>"

Switch "s for 's if you're on *nix.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?