Скаляры просочились: -2 Скаляры просочились: 2 предупреждения в многопоточном скрипте Perl - PullRequest
0 голосов
/ 04 октября 2018

В конце моего многопоточного скрипта Perl я получаю сообщение об ошибке, как показано ниже.Время от времени номер меняется.

Scalars leaked: -2 
Scalars leaked:2

Что может быть причиной этой проблемы?Это просто предупреждения?

Я создал свои темы следующим образом:

    our $threads1=3;
    our $threads2=3;

    for(my $i = 0; $i<$threads1; $i++)
    {
        $threadpool1[$i] = threads->create( \&sub1, $arg1, $arg2 , $arg2, $threads1, $threads2);
    }


    #Add work to queue1
    foreach my $work (keys %{$workobj})
    {
        $queue1->enqueue( $work );
    }

    for(my $i = 0; $i<$threads2; $i++)
    {
        $threadpool2[$i] = threads->create( \&sub2, $arg1 , $arg2);
    }

    #Wait until worker threads complete the work
    $_->join for @threadpool1;
    $_->join for @threadpool2;

    sub sub1($arg1, $arg2 , $arg2, $threads1, $threads2)
    {
        while($queue1->dequeue)
        {
              #do some work
              #send work to queue 2
              $queue2->enqueue(work);
              $queue1->enqueue(undef x threads1);
        }
        # if all work has been sent to second queue, send undef to second set of threads
        $queue1->enqueue(undef x $threads2);
        return;
    }

    sub sub1($arg1, $arg2)
    {
        while($queue2->dequeue)
        {
              #do some work
        }
        return;
    }

Есть идеи, где я ошибаюсь?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...