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.
|
|---|