Parallel Processing (Multithreading): Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „== PowerShell instances == <source lang="powershell> $a = [PowerShell]::Create().AddScript{sleep 5;'a done'} $b = [PowerShell]::Create().AddScript{sleep 5;'b…“)
 
Zeile 1: Zeile 1:
 
== PowerShell instances ==
 
== PowerShell instances ==
<source lang="powershell>
+
<source lang="powershell">
 
$a =  [PowerShell]::Create().AddScript{sleep 5;'a done'}
 
$a =  [PowerShell]::Create().AddScript{sleep 5;'a done'}
 
$b =  [PowerShell]::Create().AddScript{sleep 5;'b done'}
 
$b =  [PowerShell]::Create().AddScript{sleep 5;'b done'}

Version vom 3. Juli 2020, 12:16 Uhr

PowerShell instances

$a =  [PowerShell]::Create().AddScript{sleep 5;'a done'}
$b =  [PowerShell]::Create().AddScript{sleep 5;'b done'}
$c =  [PowerShell]::Create().AddScript{sleep 5;'c done'}
 
$r1,$r2,$r3 = ($a,$b,$c).begininvoke() # run in background
$a.EndInvoke($r1); $b.EndInvoke($r2); $c.EndInvoke($r3) # wait
($a,$b,$c).streams.error # check for errors
($a,$b,$c).dispose() # clean