RecAPI
Multi-threading in RecAPI

RecAPI of the OmniPage Capture SDK is a thread-safe API starting from version 16 (supported on: Windows). This means that the API functions can be called from different threads at the same time on Windows.

If each thread uses a Settings Collection separated only for that thread, the thread-safeness is completely true. The same Settings Collection may be also used in different threads at the same time. However, when a value in a Settings Collection is changed in one thread, this new value appears in all the threads using the same Settings Collection. In this case, it is difficult to determine when the functions in the other threads notice this modification.

If this latter case poses a problem for the integrating application, there are two solutions:

  • each thread uses its own Settings Collection dedicated only to that thread or
  • the integrating application synchronizes the setting modifications performed in Settings Collections assigned to more than one thread.

The expression thread-safe does not mean all the CSDK elements can work simultaneously.

  • Some parts of the CSDK (e.g. output converting) can run only one instance at a time, i.e. if they are called simultaneously, one waits for the other,
  • There are some operations that perform multi-threaded processing within themselves (e.g. One Step Functions Module). Calling such operations simultaneously cannot achieve higher performance.
  • There are some operations that must be called one after the other sequentially, because one waits for output from another. Of course, in such a case there is no point in calling them at the same time. E.g. the preprocessing of a page must precede the recognition of that page. Of course, these operations can be called simultaneously for different pages.
See also:
Settings Collections - General Operations Module
Settings Collections - Settings Manager Module