Skip to content

Multithreading and powershell classes #26

@brandubh

Description

@brandubh

Hi Paul, do you have any statement about powershell classes and PSThreadJob? From my observations if you instantiate an object in the main powershell thread and then spawn PSThread Jobs with that object as a param, the object methods are always executed in the powershell main thread, thus blocking execution of other threads. The simples way to check for it is adding a sleep in one method of the class and see what happens. I'm writing a post on how to use PSThreadJob to consume data items in a thread safe way, but this seems to break the design. Any clue? Here is the gist I'm working on.

Thanks in advance
Daniele

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions