firstly great work on this website. I have a few questions regarding multithreading.
I based my own code on examples found from the script library. Regarding my understanding of multithreading for one to use threads he first needs to create a runspace pool in which all threads will live in. Once this runspace pool is created do all new threads enter here automatically?
$throttleLimit = 10
#do we create an initialsessionstate here that contains an environment with all cmdlets etc?
$runspacepool = [runspacefactory]::CreateRunspacePool(1, $ThrottleLimit, $iss, $Host)
$thread = [powershell]::Create().AddScript($ScriptBlock).AddArgument($someargument)
$thread.RunspacePool = $runspacepool
here we are creating a thread, what happens if we don't add it to the runspacepool? does it run in some default runspacepool?
Also, for the sake of sanity, rather than define seperate functions in the $scriptBlock, is it somehow possible to pass an initializationblock of some sort containing those functions, that i could also make accessible in the rest of the script?
Thank you for your replies