Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Win32::Process::Info and threads

by LineStown (Initiate)
on Jan 17, 2017 at 12:30 UTC ( [id://1179737]=perlquestion: print w/replies, xml ) Need Help??

LineStown has asked for the wisdom of the Perl Monks concerning the following question:

Hello all

Could you help with perl?

I have next code (it is a mini version of trouble):

use strict; use threads; use Win32::Process::Info; sub test { print "1"; } threads->create(\&test)->join();

Result: 1Free to wrong pool 2c3fd30 not 6a8eb0 during global destruction.

It happens after ->join()

It works without ​use Win32::Process::Info;

Win32::Process::Info need for getting command line of process.

Win32::Process::Info qw{NT} doesn't give all information.

Thanks

Replies are listed 'Best First'.
Re: Win32::Process::Info and threads
by vr (Curate) on Jan 17, 2017 at 14:43 UTC

      I have tried do this:

      use strict; use warnings; use Data::Dumper; use threads; sub include_info { require 'Win32::Process::Info'; } sub test { print "1"; } include_info; my $tid = threads->create(\&test)->join();

      Result: Can't locate Win32::Process::Info in @INC

      But use works. Could you explain my mistake?

        This Win32::OLE hates Perl's threads too much... Then I'm afraid there's no other option but something like

        use strict; use warnings; use threads; use feature 'say'; sub test { my $s = 'say $_-> { CommandLine } for Win32::Process::Info-> new-> + GetProcInfo'; say qx( $^X -MWin32::Process::Info -E "$s" ); } threads-> create( \&test )-> join;
Re: Win32::Process::Info and threads
by Anonymous Monk on Jan 17, 2017 at 15:46 UTC

    From the Win32::Process::Info documentation:

    The WMI variant has various problems, known or suspected to be inherited from Win32::OLE. See "BUGS" for the gory details. The worst of these is that if you use fork(), you must disallow WMI completely by loading this module as follows:

    use Win32::Process::Info qw{NT};
Re: Win32::Process::Info and threads
by LineStown (Initiate) on Jan 17, 2017 at 15:27 UTC

    I have changed code, after require I used import Win32::Process::Info->import(qw(GetProcInfo)); and I have got Error again: Free to wrong pool 2c3fd30 not 6a8eb0 during global destruction.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1179737]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found