# Class: oThread

## $. oThread

$.oThread Base Class

#### new $.oThread(kernel, list, threadCount, start, timeout, reserveThread)

openHarmony/openHarmony_threading.js, line 71
  The base class for the $.oThread -- WIP, NOT TRULY THREADED AS THE EVENT MANAGER DOESNT ALLOW FOR THREADS YET.

  Name | Type | Description
  --- | --- | ---
  `kernel` | function | The kernel that is iterating.
  `list` | Array.<object> | The list of elements to iterate upon.
  `threadCount` | int | optional The amount of threads to initiate. Default: 5
  `start` | bool | optional Whether to start on instantiation, or to wait until prompted. Default: false
  `timeout` | int | optional Timeout in MS
  `reserveThread` | bool | optional Whether to reserve a thread for this to process while blocking.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `threadCount` | int | The amount of threads to initiate.
  `threads` | Array.<QTimer> | The underlying QTimers that behave as threads.
  `results_thread` | Array.<object> | The results from the kernel, should match indices of provided list.
  `error_thread` | Array.<string> | The errors from the kernel, in the event there are code errors.
  `complete_thread` | Array.<bool> | The completion (note: not success) state of the thread. Success state would be the result.
  `started` | bool | The start state of all threads.
  `timeout` | int | MS timeout for blocking processes.

### Methods

#### prepareThreads(block)

openHarmony/openHarmony_threading.js, line 266
  If threads are not yet prepared, this will prepare them.

  Name | Type | Description
  --- | --- | ---
  `block` | bool | optional Whether the process should block and wait for completion.

#### runSingleThreaded()

openHarmony/openHarmony_threading.js, line 337
  If started, will block until completion or timeout.

#### start(block)

openHarmony/openHarmony_threading.js, line 233
  Start the thread and block if necessary.

  Name | Type | Description
  --- | --- | ---
  `block` | bool | Whether the process should block and wait for completion.

#### wait(block_time)

openHarmony/openHarmony_threading.js, line 309
  If started, will block until completion or timeout.

  Name | Type | Description
  --- | --- | ---
  `block_time` | int | The MS time to block.