diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-12-25 02:22:19 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-12-25 02:22:19 +0200 |
commit | 10acaffde7148409585b7a1c9a5f954f95e0d3aa (patch) | |
tree | 07b6f1cd9e584d47b120dca9b76ab03f8a091890 | |
parent | eddcff455eb4e5911e198e012d6b71e8a2fdf6be (diff) | |
download | meson-10acaffde7148409585b7a1c9a5f954f95e0d3aa.zip meson-10acaffde7148409585b7a1c9a5f954f95e0d3aa.tar.gz meson-10acaffde7148409585b7a1c9a5f954f95e0d3aa.tar.bz2 |
Added explicit thread dependency.
-rw-r--r-- | dependencies.py | 11 | ||||
-rw-r--r-- | test cases/common/102 threads/meson.build | 7 | ||||
-rw-r--r-- | test cases/common/102 threads/threadprog.cpp | 14 |
3 files changed, 32 insertions, 0 deletions
diff --git a/dependencies.py b/dependencies.py index 87c1ba1..165fd2f 100644 --- a/dependencies.py +++ b/dependencies.py @@ -1059,6 +1059,16 @@ class ExtraFrameworkDependency(Dependency): def found(self): return self.name is not None +class ThreadDependency(Dependency): + def __init__(self, environment, kwargs): + super().__init__() + self.name = 'threads' + self.is_found = True + mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES')) + + def need_threads(self): + return True + def get_dep_identifier(name, kwargs): elements = [name] modlist = kwargs.get('modules', []) @@ -1108,4 +1118,5 @@ packages = {'boost': BoostDependency, 'wxwidgets' : WxDependency, 'sdl2' : SDL2Dependency, 'gl' : GLDependency, + 'threads' : ThreadDependency, } diff --git a/test cases/common/102 threads/meson.build b/test cases/common/102 threads/meson.build new file mode 100644 index 0000000..ca3eee5 --- /dev/null +++ b/test cases/common/102 threads/meson.build @@ -0,0 +1,7 @@ +project('threads', 'cpp') + +test('threadtest', + executable('threadprog', 'threadprog.cpp', + dependencies : dependency('threads') + ) +) diff --git a/test cases/common/102 threads/threadprog.cpp b/test cases/common/102 threads/threadprog.cpp new file mode 100644 index 0000000..9d140b3 --- /dev/null +++ b/test cases/common/102 threads/threadprog.cpp @@ -0,0 +1,14 @@ +#include<thread> +#include<cstdio> + +void main_func() { + printf("Printing from a thread.\n"); +} + +int main(int, char**) { + printf("Starting thread.\n"); + std::thread th(main_func); + th.join(); + printf("Stopped thread.\n"); + return 0; +} |