# FixTask Documentation

Back to summary

`import "task/task";`

## ComputeTask class

ComputeTask allows to run computation code in parallel on multiple CPU cores.

### Functions

`static function create(): ComputeTask
static function create(finish_data): ComputeTask`
  Creates a new compute task. The provided data is passed to the finish function and it's not cloned to the compute thread.
`virtual function process(): Dynamic`
  Runs the computation code, the result is passed to `finish` function in the main thread.
`virtual function finish(data, result)`
  Finishes the computation. The data is reference in the current thread and the result is cloned from the computation thread.
`function run()`
  Runs the task in a computation thread. It also runs `finish` functions for any finished tasks.

### Static functions

`static function run(process_func, process_data)
static function run(process_func, process_data, finish_func, finish_data)
`
  Runs the `process` function in the computation thread, passing the result back to `finish` function in the main thread.
`static function check_finished()`
  Checks for finished computation tasks to run their `finish` functions.
`static function finish_all()`
  Waits for all unfinished computation tasks to finish and run their `finish` functions.