Doing multi-threading jobs inside AutoCAD .Net plugin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am aware that Autocad APIs are not supposed to be called/used in multi-threading. But how about doing a multi-thread job(in an Autocad .Net plugin) that does not involve any specific Autocad calls/type?
The situation is like this:
1.some CAD polylines are fetched through APIs, their properties that are of interest are wrapped in custome types and then
2.In another layer some multi-thread calculations are done against these custome types.
3.The application custome types writing their results back to the CAD polylines through Autocad APIs.
Only step two is done in multi-threads.
The application uses StartTransaction() method to get the Transaction object. I haven't experienced any crashing so far for many years. But now I am trying to use StratOpenCloseTransasction() it crashes many times. Specially it crashes when Editor.Rengen() is called as I think it goes through every object in database and perhaps some are corrupted. I did narrow down the problem and one of the causes apparently is this multi-threading.
Is there any reason that CAD should crashes in calling multi-threads although no APIs is engaged? Am I safe to use multi-threading in this way?
Does StartTransaction() handles objects better than StartOpenCloseTransaction in terms of disposing them? As I didn't experience crashing on that.
Many thanks,
Ali