Help for this page

Select Code to Download


  1. or download this
    my $q = Thread::Queue->new; ## create a new **EMPTY** queue
    
    ...
    
     my $cpu_monitor_thread = threads->create( \&monitor_cpu ); ## Start y
    +our threads with the queue empty/
     my $mem_monitor_thread = threads->create( \&monitor_mem )
    
  2. or download this
    sub monitor_cpu {
    
    ...
         }
         return $cap;
     }
    
  3. or download this
    
    my $done :shared = 0;
    ...
    ## To stop the queue(s)
    $done = 1;
    $mon->join;