You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It just tries to run Register-PSRepository in parallel the given number of times. The default is to use a mutex to actually serialize the calls to the functions Get-PSRepository and Register-PSRepository (thus killing the parallelism, of course, but this is a different story). Passing -MockMutex switch replaces a real mutex object with a mock.
Strange things happen when calling with the mock and N greater than 1:
PS C:\> .\1.ps1 -MockMutex -N 2Get-RunspaceData : A parameter cannot be found that matches parameter name 'Provider'.
At C:\misc\Invoke-Parallel.ps1:591 char:13+Get-RunspaceData-wait
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Write-Error], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Get-RunspaceData
[37616] BEGIN[r1]
[37616] [r1]END
Name InstallationPolicy SourceLocation
------------------------------------
r1 Trusted C:\Users\MKHARI~1\AppData\Local\Temp\fb22c60e-a0c5-48b3-953a-0b580c6a2f5e\r1
PS C:\>
All works fine when N = 1 or when called with a real mutex object.
The only explanation that I see is that the Get/Register-PSRepository functions are not multi-thread safe and calling them in parallel screws things up in such a way that it affects Invoke-Parallel somehow.
The text was updated successfully, but these errors were encountered:
Please, observe the following script:
It just tries to run
Register-PSRepository
in parallel the given number of times. The default is to use a mutex to actually serialize the calls to the functionsGet-PSRepository
andRegister-PSRepository
(thus killing the parallelism, of course, but this is a different story). Passing-MockMutex
switch replaces a real mutex object with a mock.Strange things happen when calling with the mock and N greater than 1:
All works fine when
N = 1
or when called with a real mutex object.The only explanation that I see is that the
Get/Register-PSRepository
functions are not multi-thread safe and calling them in parallel screws things up in such a way that it affectsInvoke-Parallel
somehow.The text was updated successfully, but these errors were encountered: