Is MultiTerm API thread safe?

Dear all,

currently, I'm developing a commandline application for importing data into a MultiTerm server database.
Unfortunately, I'm facing issues (System.ArgumentException) in that application. I'm trying to run the ".ProcessImport(MultiTermIX.MtTaskType.mtScript)" in a new thread to be able to stop the import process, if it takes much longer than normal.
The application is developed in Visual Basic.
My question therefore is, if the API from MultiTerm is thread safe and if it is possible to outsource the import process to a new, independent process/thread.

If you have any further questions or any hints, please don't hesitate to let me know.

Thank you very much in advance for your soon reply.
Best regards and have an easy day
Nils

Parents Reply
  • Then, my original question is still relevant. I'd love to get an answer if the MultiTerm API is thread save and if it's possible to run the .ProcessImport method in a new thread.

    Hi  ,  I suspect that the short answer is no.

    Simply because I know that Multiterm is a COM automation API, which use STA (sinle theaded aparment), e.g. not guarenteed thread safe. From experience, calling COM from MTA or attemptting to marshel it accross threads more often leads to unpredictable behaviour.  I'm old enough to simply not do it  anymore, I like sleeping and not working/debugging all night :-)

    I would recommend:

    • Use it from a single STA thread only. Do not create objects on one thread and call them from another like you're attempting here.
    • ProcessImport is a synchronous, blocking COM call. I suspect that there is no supported way to cancel it mid-call or safely abort the thread.
    • If you need a hard timeout/cancellation, run the import in a separate helper process and kill that process on timeout.

       can also confirm this with the multiterm team directly?  although, I'd doubt the answer is different to what I'm writing here.

    Patrick Andrew Hartnett | Developer Experience | Team Lead | RWS Group

Children