Multithreading

The OrcFxAPI DLL is thread safe in the sense that different threads can operate on different models concurrently. Models have affinity to a particular thread. That is, all calls to functions which operate on a particular model, or objects within that model, must be made from the same thread. When a model is created it has affinity to the thread in which it is created. A model can be assigned affinity to a different thread by taking the following steps:

  1. Call C_DetachFromThread from the thread to which the model currently has affinity.
  2. Call C_AttachToThread from a different thread, after which the model will have affinity to this thread.

There are special implications for external function thread safety.