Async multithreaded document read

Say I don’t update / add anything on the active RhinoDoc but merely read data from it such as object properties, materials Table, etc, on background tasks. Is this still going to create thread safety issues?

Using C# with RhinoCommon

Here @stevebaer mentioned that Rhino.Geometry namespace is thread safe. Whereas here @nathanletwory suggests that even reading would not be thread safe.

I get why Nathan is saying that. If a background task takes more than a second, there is a small chance that the user might update the document while the background task is running.

I thought I’d ask for opinion before I give up the idea of multithreading and just run everything on the main thread sequentially.

Nathan is correct; even reading may not be thread safe as the user could be doing all sorts of things on the main thread that could alter the document or even get rid of it if the user chose to open a different model. You would need to ensure that the main thread is not changing the document which typically ends up forcing a modal message box upon the user.

1 Like

Might as well run on the main thread sequentially then.