in reply to detach for threads
#!/usr/bin/perl -slw use strict; use Time::HiRes qw(sleep); use threads 'exit' => 'threads_only'; my $thr = threads->create(\&new_func)->join(); $thr = threads->exit(); sub new_func { my $cnt = 0; print "Thread is running..."; while ($cnt <= 500) { print "Count is: $cnt"; sleep 0.002; ++$cnt; } return; }
|
|---|