# ThreadNew

Creates a new thread of execution based on the passed closure/lambda.

## Method Signature

```
ThreadNew(runnable=[function], attributes=[struct], name=[string], priority=[string], virtual=[boolean])
```

### Arguments

| Argument     | Type       | Required | Description                                                                                                                            | Default  |
| ------------ | ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `runnable`   | `function` | `true`   | The closure/lambda to execute in the new thread.                                                                                       |          |
| `attributes` | `struct`   | `false`  | A struct of data to bind into the thread's scope.                                                                                      | `{}`     |
| `name`       | `string`   | `false`  |                                                                                                                                        |          |
| `priority`   | `string`   | `false`  | The priority of the thread. Possible values are "high", "low", and "normal". Default is "normal".                                      | `normal` |
| `virtual`    | `boolean`  | `false`  | If true, the thread will be a [virtual thread](https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html). Default is false. | `false`  |

## Examples

## Related

* [AsyncAll](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/asyncall)
* [AsyncAllApply](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/asyncallapply)
* [AsyncAny](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/asyncany)
* [AsyncRun](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/asyncrun)
* [ExecutorDelete](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/executordelete)
* [ExecutorGet](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/executorget)
* [ExecutorHas](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/executorhas)
* [ExecutorList](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/executorlist)
* [ExecutorNew](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/executornew)
* [ExecutorShutdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/executorshutdown)
* [ExecutorStatus](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/executorstatus)
* [FutureNew](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/futurenew)
* [IsInThread](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/isinthread)
* [isThreadAlive](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/isthreadalive)
* [IsThreadInterrupted](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/isthreadinterrupted)
* [RunAsync](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/runasync)
* [ThreadInterrupt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/threadinterrupt)
* [ThreadJoin](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/threadjoin)
* [ThreadTerminate](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/async/threadterminate)
