Multithreading example

Multithreading is the ability of an application to maintain several execution 'threads' of the same program in memory. This is a highly efficient method that may be employed by an application to perform several concurrent tasks with the minimum duplication of system resources.

Batch API supports up to 32 separate API instance handles (see QABatchWV_Open), each with up to 8 related search handles (see QABatchWV_Clean). Attempting to use any more threads or instances will cause Batch API to return an error.

Batch API uses additional RAM for each API instance and search handle used. The amount required varies depending on which countries and datasets you are using. You will need to ensure you have enough available memory to use your required number of API instance handles and related search handles. If there is insufficient memory available, Batch API will return an 'out of memory' error. To remedy this, you will need to reduce the number of instance handles or search handles until this error is no longer returned. Note that if you are using the 32-bit version of Batch API, the operating system will limit the amount of RAM to a maximum of 4GB per application.

When using Batch API with more than one execution thread, there are limitations in using the handles issued by the API. It is currently the integrator's responsibility to enforce these rules, and instability or incorrect results may occur if this advice is ignored.

  1. API Instance Handles: You may use QABatchWV_Clean simultaneously with multiple threads and the same API instance handle. Any other Batch API function that accepts an API instance handle may only be used by one thread for each API instance handle at any one time.
  2. Search Handles: Any search handle may only be used by one thread at any one time.
Batch API

API reference (SOAP)