2017-05-03 17:38:41 +08:00
|
|
|
---
|
|
|
|
short-description: Enabling thread support
|
|
|
|
...
|
|
|
|
|
2017-03-30 02:03:43 +08:00
|
|
|
# Threads
|
|
|
|
|
2021-01-30 19:20:59 +08:00
|
|
|
Meson has a very simple notational shorthand for enabling thread
|
|
|
|
support on your build targets. First you obtain the thread dependency
|
|
|
|
object like this:
|
2017-03-30 02:03:43 +08:00
|
|
|
|
|
|
|
```meson
|
|
|
|
thread_dep = dependency('threads')
|
|
|
|
```
|
|
|
|
|
|
|
|
And then you just use it in a target like this:
|
|
|
|
|
|
|
|
```meson
|
|
|
|
executable('threadedprogram', ...
|
|
|
|
dependencies : thread_dep)
|
|
|
|
```
|