function wait_for_procs_finish()
{
    global $counter;
    $processes = get_procs_count();
    if ($counter == 0) {
        echo ">>> [" . date("H:i:s") . "] Waiting for previous build processes to finish...";
    }
    while ($processes >= 1) {
        $processes = get_procs_count();
        $counter++;
        if ($counter > 120) {
            $counter = 0;
            echo ".";
        }
        sleep(1);
    }
    echo "\n";
}
function wait_for_procs_finish()
{
    global $counter, $DCPUS;
    $processes = get_procs_count();
    if ($counter == 0) {
        echo ">>> Waiting for previous build processes to finish...";
    }
    while ($processes >= $DCPUS) {
        $processes = get_procs_count();
        $counter++;
        if ($counter > 120) {
            $counter = 0;
            echo ".";
        }
        sleep(1);
    }
    echo "\n";
}