PaulHigin / PSThreadJob

A PowerShell module for running concurrent jobs based on threads rather than processes
MIT License
180 stars 18 forks source link

Initial upload of files for PowerShell ThreadJob module #1

Closed PaulHigin closed 6 years ago

PaulHigin commented 6 years ago

This upload includes all files to build the ThreadJob module in Visual Studio as a PowerShell module, as well as Pester basic tests. Most files are auto-generated by Visual Studio and the important files to look at are:

PSThreadJob.cs
ThreadJob.psd1
Pester.ThreadJob.Tests.ps1

ThreadJob is a simple module that consists of a single cmdlet (Start-ThreadJob). This cmdlet is intended to mirror the existing Start-Job cmdlet, with the difference that the job is run in a separate runspace/thread rather than in a separate process. So it is lighter weight, faster (since it doesn't use PSRP), and returns "live" objects instead of re-hydrated serialized objects.

One major difference is that there is now a -ThrottleLimit parameter to limit the number of concurrent threads running, along with a queue for jobs waiting to run.

The 'using' keyword is not yet supported because the infrastructure to support this is currently internal access in PowerShell and needs to be made public for this module to use it.