Cancel
Showing results for 
Search instead for 
Did you mean: 

does PS .net support multi thread programming?

Creator
Creator

I got a time consuming process, so i want to put it into another thread, but PS just collapse without any erro information. Does PS .net support creating a new thread?

 

1 REPLY

Re: does PS .net support multi thread programming?

Siemens Legend Siemens Legend
Siemens Legend

Process Simulate runtime environment should be assumed to be single-threaded.

For example, if you are using any ITxObject, or the TxApplication singleton to access or modify the PS runtime model from a different thread other than the main thread - you will probably get a crash due to concurrent access to shared resources.

 

That being said, creating threads is possible in the .NET environment, just as long as you make sure not to update or read any information from a Tx object. Typically I might use a worker thread for handling communication (e.g., listening on sockets), but always make sure that there is a thread-safe message queue used between the worker thread and the main thread - which is the only thread to access the PS runtime model.

 

What exactly is time consuming about your process?

If you share more details about what you are trying to compute/collect, the community might come with other suggestions how to optimize it.