Thread Threads durchlaufen
(11 answers)
Opened by mika at 2019-08-30 19:22
Mein do-while hier, besonders wie ich das sleep anwende, ist wohl ganz schlechter Stiel?
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 sub loop_threads { # Threads durchlaufen my ( $handler_sub, $max_threads ) = @_; do { for ( ($max_threads) ? threads->list(threads::joinable) : threads->list() ) { &{$handler_sub}( $_->join ); } } while ( $max_threads && threads->list >= $max_threads && sleep 3 ); } |