diff options
author | sghctoma <sghctoma@gmail.com> | 2018-09-02 18:32:31 +0200 |
---|---|---|
committer | sghctoma <sghctoma@gmail.com> | 2018-09-02 18:32:31 +0200 |
commit | 3b2b8c18446bb98ec0e5eea46fb1212b7bf64445 (patch) | |
tree | 1efb3ccee04a7589a1c963b3cace215ca8236c56 /examples | |
parent | 2bd6fbf20ebb055d4871ffb8eedefa7d7aa60ee8 (diff) | |
parent | 95d05acda511e8559ab87a3d8956ee942ca1999e (diff) |
Merge remote-tracking branch 'upstream/master' into fix-freebsd-direct-session
Diffstat (limited to 'examples')
-rw-r--r-- | examples/idle.c | 21 | ||||
-rw-r--r-- | examples/meson.build | 34 |
2 files changed, 35 insertions, 20 deletions
diff --git a/examples/idle.c b/examples/idle.c index 30e106db..87a03924 100644 --- a/examples/idle.c +++ b/examples/idle.c @@ -152,14 +152,20 @@ int main(int argc, char *argv[]) { .display = display, }; - if (simulate_activity_timeout != 0 && simulate_activity_timeout < close_timeout) { + bool create_t1 = (simulate_activity_timeout != 0) && + (simulate_activity_timeout < close_timeout); + + if (create_t1) { if (pthread_create(&t1, NULL, &simulate_activity, (void *)&arg) != 0) { return -1; } } - if (close_timeout != 0) { + + bool create_t2 = (close_timeout != 0); + + if (create_t2) { if (pthread_create(&t2, NULL, &close_program, (void *)&arg) != 0) { - if (simulate_activity_timeout != 0) { + if (create_t1) { pthread_cancel(t1); } return -1; @@ -170,18 +176,19 @@ int main(int argc, char *argv[]) { fprintf(stdout, "waiting\n"); if (pthread_create(&t3, NULL, &main_loop, (void *)display) != 0) { - if (simulate_activity_timeout != 0) { + if (create_t1) { pthread_cancel(t1); } - if (close_timeout != 0 ) { + if (create_t2) { pthread_cancel(t2); } + return -1; } - if (simulate_activity_timeout != 0) { + if (create_t1) { pthread_join(t1, NULL); } - if (close_timeout != 0) { + if (create_t2) { pthread_join(t2, NULL); } pthread_cancel(t3); diff --git a/examples/meson.build b/examples/meson.build index 0fb37a9e..b5ad6c98 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -20,31 +20,31 @@ endif examples = { 'simple': { 'src': 'simple.c', - 'dep': wlroots, + 'dep': [wlroots], }, 'pointer': { 'src': 'pointer.c', - 'dep': wlroots, + 'dep': [wlroots], }, 'touch': { 'src': ['touch.c', 'cat.c'], - 'dep': wlroots, + 'dep': [wlroots], }, 'tablet': { 'src': 'tablet.c', - 'dep': wlroots, + 'dep': [wlroots], }, 'rotation': { 'src': ['rotation.c', 'cat.c'], - 'dep': wlroots, + 'dep': [wlroots], }, 'multi-pointer': { 'src': 'multi-pointer.c', - 'dep': wlroots, + 'dep': [wlroots], }, 'output-layout': { 'src': ['output-layout.c', 'cat.c'], - 'dep': wlroots, + 'dep': [wlroots], }, 'screenshot': { 'src': 'screenshot.c', @@ -93,10 +93,18 @@ examples = { } foreach name, info : examples - executable( - name, - info.get('src'), - dependencies: info.get('dep'), - build_by_default: get_option('examples'), - ) + all_dep_found = true + foreach d : info.get('dep') + all_dep_found = all_dep_found and d.found() + endforeach + if all_dep_found + executable( + name, + info.get('src'), + dependencies: info.get('dep'), + build_by_default: get_option('examples'), + ) + else + warning('Dependencies not satisfied for ' + name) + endif endforeach |