我試圖在腳本中更改線程優先級,但沒有成功,這裏是詳細信息。更改線程優先級ERROR_INVALID_HANDLE
$thr = threads->new(\&someFunction,
$shared variable 1,
$shared variable 2,
);
我試過使用threads::State
;
$thr->priority(2);
沒有成功
所以,我認爲Win32::API
必須努力
my $functionGetLastError= Win32::API->new('Kernel32',
'GetLastError',
'',
'N'
);
my $functionSetThreadPriority= Win32::API->new('Kernel32',
'SetThreadPriority',
'II', # I've tried 'PI' and 'II' as well
'N'
);
my $h = $thr->_handle();
my $success = $functionSetThreadPriority->Call($h, 2);
warn "Return Error #".$functionGetLastError->Call() if !$success;
再次,沒有成功:(,但現在我有一個線索,該腳本返回錯誤號
最後錯誤6
從MSDN site, System Error Codes (0-499),似乎錯誤是
ERROR_INVALID_HANDLE
我在做什麼錯?
參見[什麼樣的線程是Perl的線程?](http://perldoc.perl.org/perlthrtut.html#What-kind-of-threads-are-Perl-threads%3f)在文檔。 – choroba 2014-12-03 13:37:27