Thread Threads durchlaufen (11 answers)
Opened by mika at 2019-08-30 19:22

mika
 2019-09-08 10:12
#190449 #190449
User since
2010-10-02
159 articles
BenutzerIn
[Homepage]
user image
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 );

}

View full thread Threads durchlaufen