Menu
Simba Technologies
Simba Technologies

SimbaEngine X SDK 10.1.3
Developing Drivers for Data Stores Without SQL

Threading Overview

The SimbaEngine X SDK typically handles all processing in a single thread, using the same thread as the application uses to make the ODBC or JDBC request. However, multiple threads may be started in the following cases:

  • If the application creates a new thread for each ODBC or JDBC connection, each request is processed on its own thread. Processing is handled concurrently.
  • In a client/server deployment, multiple clients can send a request to the same Simba Server. SimbaServer handles each request on its own thread.

In addition, the SimbaEngine X SDK provides support for multithreading that you can use in your custom ODBC or JDBC driver.

Using the Thread Class (C++ only)

The Thread class provides the implementation for a thread. There are different options for using this class in your custom driver:

  • You can subclass the Thread class and implement the DoExecute() interface.
  • Or, you can call StartDetachedThread(), passing in a pointer to a function that will be executed when the thread is started.

Note:

There is no overall difference in functionality between these methods.

Using the ThreadPool Class

The ThreadPool class starts and manages the running threads. It implements the pool of threads, and is responsible for creating new threads and assigning tasks to them.

To implement a multi-threaded environment using the ThreadPool class:

  1. To make a runnable task, subclass ITask and implement the Run() method.
  2. Call the PostTask() method to add runnable tasks to a queue of unprocessed tasks on the ThreadPool class.

Note:

The maximum number of threads is specified by m_maxThreads.