[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-users
Subject:    Re: WMI Asynchronous Calls
From:       wagnerc () plebeian ! com (Chris Wagner)
Date:       2006-06-21 17:22:12
Message-ID: 200606211707.k5LH7nd27010 () mail ! cinternet ! net
[Download RAW message or body]

I would speed it up my making it multithreaded.  This is really pretty easy.
Read up on the threads pragma in the docs.  U could then do 10 or 20
simultaneously no problem.

something like:
threadlimit = 10;
while (threads < threadlimit) {
        last unless @machinestocheck;
        async(dosomething);
}
sub dosomething {
        threads++;
        pop @machinestocheck;
        do work
        threads--;
}


At 11:01 AM 6/21/2006 +0100, Paul Sobey wrote:
>I have a script which restarts services on around 400 clients. At the
>moment, the script connects to WMI on each machine separately and calls
>Win32_Service->StopService(), followed by Win32_Service->StartService().
>
>I'd like to speed it up a bit and thought of using the WMI asynchronous
>providers to group a whole load of stop() requests, followed by a whole
>load of start requests, but I confess I have no idea where to start. Does
>anybody have any sample code or pointers to offer?






--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic