Summary
This chapter explored the job commands built into PowerShell; since they are built-in, they are a solid starting point for running asynchronous operations. Newer modules such as ThreadJob
can be used to improve the efficiency of jobs.
You used event subscribers and commands to react to and work with events on .NET objects.
The final section detailed working with runspaces and runspace pools. These provide the greatest flexibility when working asynchronously.
Thread-safe types, such as those in the System.Collections.Concurrent
namespaces, were demonstrated as a means of accessing and updating collections of objects across threads.
Finally, a Mutex was demonstrated as a means of safely gaining exclusive access to a resource when code is running asynchronously.
The next chapter explores the creation of graphical user interfaces in PowerShell.
Learn more on Discord
Read this book alongside other users, PowerShell experts, and the author himself. Ask...