Added explicit thread dependency.

pull/340/head
Jussi Pakkanen 9 years ago
parent eddcff455e
commit 10acaffde7
  1. 11
      dependencies.py
  2. 7
      test cases/common/102 threads/meson.build
  3. 14
      test cases/common/102 threads/threadprog.cpp

@ -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,
}

@ -0,0 +1,7 @@
project('threads', 'cpp')
test('threadtest',
executable('threadprog', 'threadprog.cpp',
dependencies : dependency('threads')
)
)

@ -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;
}
Loading…
Cancel
Save